Version française
Home     About     Download     Resources     Contact us    
Browse thread
C binding and GC interaction: storing values outside the heap
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Romain Beauxis <toots@r...>
Subject: Re: [Caml-list] C binding and GC interaction: storing values outside the heap
	Hi,

Le mardi 7 septembre 2010 15:58:04, Paolo Donadeo a écrit :
> Any ideas or suggestions?

I'm sorry if I missed something obvious, but why don't you simply require the 
callback in the CAMLprim function's arguments and then wrap it in the ML code?

Something like:

.ml:

  type handler
  type callback = foo -> bar

  type t = handler * callback

  val foo : handler -> callback -> bar = "caml_lua_foo"

  let foo (h,c) = foo h c

.mli:

  type t

  val foo : t -> bar


Romain