import source from 1.3.40
[external/swig.git] / Examples / ocaml / simple / example_prog.ml
1 (* example_prog.ml *)
2
3 open Swig
4 open Example
5
6 (* Call our gcd() function *)
7
8 exception NoReturn
9
10 let x = 42 to int
11 let y = 105 to int
12 let g = _gcd '(x,y) as int
13 let _ = Printf.printf "The gcd of %d and %d is %d\n" (x as int) (y as int) g
14
15 (* Manipulate the Foo global variable *)
16
17 (* Output its current value *)
18 let _ = Printf.printf "Foo = %f\n" (_Foo '() as float)
19
20 (* Change its value *)
21 let _ = _Foo '(3.1415926)
22
23 (* See if the change took effect *)
24 let _ = Printf.printf "Foo = %f\n" (_Foo '() as float)
25
26
27
28
29
30
31
32
33