/tags/rel-1-3-29/SWIG/Examples/test-suite/ocaml/typedef_mptr_runme.ml
OCaml | 16 lines | 14 code | 2 blank | 0 comment | 2 complexity | 52cc464de93502265242225ce483b8b8 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1open Swig 2open Typedef_mptr 3 4let soci x = (string_of_int (get_int x)) 5 6let x = new_Foo C_void 7let add_res = _do_op (C_list [ x ; C_int 2 ; C_int 1 ; _add ]) 8and sub_res = _do_op (C_list [ x ; C_int 2 ; C_int 1 ; _sub ]) 9let _ = 10 if add_res <> (C_int 3) || sub_res <> (C_int 1) then 11 raise (Failure ("Bad result:" ^ 12 " (add " ^ (soci add_res) ^ ") " ^ 13 " (sub " ^ (soci sub_res) ^ ")")) 14let _ = Printf.printf "2 + 1 = %d, 2 - 1 = %d\n" 15 (get_int add_res) 16 (get_int sub_res)