/trunk/Examples/test-suite/ocaml/typedef_mptr_runme.ml

# · OCaml · 16 lines · 14 code · 2 blank · 0 comment · 2 complexity · 52cc464de93502265242225ce483b8b8 MD5 · raw file

  1. open Swig
  2. open Typedef_mptr
  3. let soci x = (string_of_int (get_int x))
  4. let x = new_Foo C_void
  5. let add_res = _do_op (C_list [ x ; C_int 2 ; C_int 1 ; _add ])
  6. and sub_res = _do_op (C_list [ x ; C_int 2 ; C_int 1 ; _sub ])
  7. let _ =
  8. if add_res <> (C_int 3) || sub_res <> (C_int 1) then
  9. raise (Failure ("Bad result:" ^
  10. " (add " ^ (soci add_res) ^ ") " ^
  11. " (sub " ^ (soci sub_res) ^ ")"))
  12. let _ = Printf.printf "2 + 1 = %d, 2 - 1 = %d\n"
  13. (get_int add_res)
  14. (get_int sub_res)