Version française
Home     About     Download     Resources     Contact us    
Browse thread
Wrapping OCaml function returning a variant
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: micha <micha-1@f...>
Subject: Re: [Caml-list] Wrapping OCaml function returning a variant
Am Wed, 28 Mar 2007 13:51:39 +0100
schrieb Joel Reymont <joelr1@gmail.com>:

> One last question which I couldn't answer by browsing through  
> mltypes.h...
> 
> What is the type of a on the C side?

that may look like:

CAMLprim value cfunc(value x)
{
CAMLparam1(x);
switch (Tag_val(x)) {
	case 0: do something with first variant;
	case 1: do something  with second variant
	default: argh;
}
CAMLreturn(Val_unit);
}


 Michael