Hi!

I've found in OCaml manual how to call object's method without arguments. But I have no idea how to call method with some arguments.
For example I have this OCaml code:

external call_meth: < .. > -> unit = "call_a_meth"

class a = object
  method foo x = print_endline x
end;;

and C code:

CAMLprim
value call_a_meth(value obj) {
  CAMLparam1(obj);
  CAMLlocal3(meth, meth2, arg1);
  meth = caml_get_public_method(obj, caml_hash_variant("foo") ) ;
  if (meth == 0)
       printf ("Fuck\n");
  arg1 = Val_int(1);
//  caml_callback2(meth, obj, arg1); // segfault in this line
  meth2 = caml_callback(meth, obj);  // no crash, but method's body is not being executed
  caml_callback(meth2, arg1);        // segfault.
  CAMLreturn(Val_unit);
}

I've tested three variants of calling above, But I still can't call a method with parameters. Any ideas?

Best wishes,
Kakadu