/tags/rel-1.3.35/Examples/test-suite/ocaml/typename_runme.ml

# · OCaml · 12 lines · 8 code · 3 blank · 1 comment · 0 complexity · cff61cf98804ea72ca5916ec3816746a MD5 · raw file

  1. (* Fun with type names -- stolen from the ruby runme *)
  2. open Swig
  3. open Typename
  4. let f = new_Foo C_void
  5. let b = new_Bar C_void
  6. let x = _twoFoo f
  7. let _ = match x with C_double f -> () | _ -> raise (Failure "not a float")
  8. let y = _twoBar b
  9. let _ = match y with C_int i -> () | _ -> raise (Failure "not an int")