diff options
| author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2009-08-18 20:56:02 +0000 |
|---|---|---|
| committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-25 16:59:08 +0000 |
| commit | 9f8a09ed743cedd9547bf0661d518647966ab114 (patch) | |
| tree | 9c7803d3b27a8ec22e91792ac7f7932efa128b20 /Examples/ocaml/simple/example_prog.ml | |
| download | swig-tarball-master.tar.gz | |
Imported from /srv/lorry/lorry-area/swig-tarball/swig-1.3.40.tar.gz.HEADswig-1.3.40master
Diffstat (limited to 'Examples/ocaml/simple/example_prog.ml')
| -rw-r--r-- | Examples/ocaml/simple/example_prog.ml | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/Examples/ocaml/simple/example_prog.ml b/Examples/ocaml/simple/example_prog.ml new file mode 100644 index 0000000..cc3b973 --- /dev/null +++ b/Examples/ocaml/simple/example_prog.ml @@ -0,0 +1,33 @@ +(* example_prog.ml *) + +open Swig +open Example + +(* Call our gcd() function *) + +exception NoReturn + +let x = 42 to int +let y = 105 to int +let g = _gcd '(x,y) as int +let _ = Printf.printf "The gcd of %d and %d is %d\n" (x as int) (y as int) g + +(* Manipulate the Foo global variable *) + +(* Output its current value *) +let _ = Printf.printf "Foo = %f\n" (_Foo '() as float) + +(* Change its value *) +let _ = _Foo '(3.1415926) + +(* See if the change took effect *) +let _ = Printf.printf "Foo = %f\n" (_Foo '() as float) + + + + + + + + + |
