Erik de Castro Lopo wrote:
> This is strange, it wasn't declared with a CAMLlocal macro and it
> was working, but if I do declare it with one the program segfaults
> during garbage collection (caml_oldify_local_roots).
Ok, with the help of someone off list I've sorted this out to
my satisfaction. Things learned:
a) In the C stub function, the call to CAMLParamN must be the
first thing in the function, followed by any CAMLlocalN
declarations. These should even occur before before any
declarations of local C variables.
b) caml_copy_nativeint creates a boxed native int (either Int32.t
or Int64.t) not an unboxed Ocaml int. To create an unboxed
Ocaml int, Val_int() is the correct macro.
Thanks to all that responded.
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
--
Caml-list mailing list. Subscription management and archives:
https://sympa-roc.inria.fr/wws/info/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs