[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 22/28] libxl: ocaml: event management
> > Good point. The original value may go out of scope in the OCaml > > program and will then be GC'ed. We should copy the value to avoid > > trouble. To do that, though, we need to know the type of the thing, > > which is currently polymorphic. I'll just go ahead and make it a > > string instead, because that seems to be the most useful. > > Is there not a way to take a GC reference on a value or to otherwise make it > possible for the GC to know you've kept hold of it? You can keep the value alive in the "main" function or toplevel. But you'd then have to rely on the user of the bindings library to do this properly at the cost of a crashing program. Or perhaps add some higher-level code to these bindings, but at this point I thought it was better to keep things simple... > Apparently not. I expect the intention was that the void *user would > contain reference to it. > > There's nothing to stop you from wrapping the applications user value in a > stub struct which you pass to libxl on register and then unpack here though. > Likewise the application could bundle the CTX into the ocaml user value and > extract it again to use it. Cool, that sounds like a good solution. > > The bigger issue is the const which actually stops you freeing it, without a > horrible cast. > <1365684384.8036.104.camel@xxxxxxxxxxxxxxxxxxxxxx> has more details on > that one. Interesting... But I guess there is no other option than use the cast at the moment? Rob _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |