[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: camlSys__entry vs. FreeBSD kmod

On Wed, Jul 11, 2012 at 01:55:01PM +0100, Anil Madhavapeddy wrote:
> The function has to return a well-formed OCaml heap value that matches
> the type of the external function declaration (in this case, a string*int).

Okay, I did that, but that still does not seem to help as the code still
crashes at the same place.

In the meanwhile I started to experiment with a different solution, e.g.
calling the Caml back from C:

let rec fib n = ... (* your favorite fib function *)

let main _ = fib 100
let _ = Callback.register "main" main

Then in C:

main_closure = caml_named_value("main");
if (!main_closure) bail_out();
caml_callback(*main_closure, Val_int(42));

And that actually seems to work... (at least got a kernel stuck on
calculating :-D)

> For additional reading btw, it's worth going through this short 6-post
> blog series about how the OCaml heap works:

Cool, thanks for the pointer, I will read this.



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.