diff --git a/SWIG/Lib/ocaml/swig.ml b/SWIG/Lib/ocaml/swig.ml index ff58fc575..60917c57e 100644 --- a/SWIG/Lib/ocaml/swig.ml +++ b/SWIG/Lib/ocaml/swig.ml @@ -31,7 +31,7 @@ exception NotObject of empty_enum c_obj_t exception NotEnumType of empty_enum c_obj_t exception LabelNotFromThisEnum of empty_enum c_obj_t -let invoke obj = match obj with C_obj o -> o | _ -> raise (NotObject obj) +let invoke obj = match obj with C_obj o -> o | _ -> raise (NotObject (Obj.magic obj)) let _ = Callback.register "swig_runmethod" invoke let fnhelper fin f arg = let args = match arg with C_list l -> l | C_void -> [] | _ -> [ arg ] in diff --git a/SWIG/Lib/ocaml/swig.mli b/SWIG/Lib/ocaml/swig.mli index bc3673a7d..e7198b73b 100644 --- a/SWIG/Lib/ocaml/swig.mli +++ b/SWIG/Lib/ocaml/swig.mli @@ -20,6 +20,7 @@ type 'a c_obj_t = | C_enum of 'a | C_director_core of 'a c_obj_t * 'a c_obj_t option ref +val invoke : 'a c_obj_t -> (string -> 'a c_obj_t -> 'a c_obj_t) val convert_c_obj : 'a c_obj_t -> 'b c_obj_t val get_int : 'a c_obj_t -> int