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

Re: [Xen-devel] [PATCH v4 23/27] libxl: ocaml: add VM lifecycle operations

> On Wed, 2013-11-06 at 17:50 +0000, Rob Hoes wrote:
> > +   if (async != Val_none) {
> > +           ao_how->callback = async_callback;
> > +           ao_how->u.for_callback = (void *) Some_val(async);
> > +           CAMLreturnT(libxl_asyncop_how *, ao_how);
> > +   }
> > +   else
> > +           CAMLreturnT(libxl_asyncop_how *, NULL);
> This doesn't appear to be in my caml headers on Debian Wheezy (3.12.1-4).
> A random hit on google http://docs.camlcity.org/docs/godisrc/oasis-ocaml-
> fd-1.1.1.tar.gz/ocaml-fd-1.1.1/lib/fd_stubs.c suggests this was new in 3.09.4
> so why don't I have it?

That's very odd... I am just doing what is advised on 
http://caml.inria.fr/pub/docs/manual-ocaml-312/manual032.html#toc14, which is 
the official documentation for OCaml 3.12.

> We would really like to keep this stuff working with some of the more
> common distro's stable versions of ocaml, so if this is really missing then
> perhaps a compat version would be needed?

I'll see if I can find out more...

> WTF is it doing anyway? Something to do with this C struct pointer
> containing a Value?

The docs say:
"The macros CAMLreturn, CAMLreturn0, and CAMLreturnT are used to replace the C 
keyword return. Every occurence of return x must be replaced by CAMLreturn (x) 
if x has type value, or CAMLreturnT (t, x) (where t is the type of x); every 
occurence of return without argument must be replaced by CAMLreturn0. If your C 
function is a procedure (i.e. if it returns void), you must insert CAMLreturn0 
at the end (to replace Câs implicit return)."

My compiler complained when I initially tried to use just CAMLreturn().

Xen-devel mailing list



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