Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] "Nasty" functions and memory usage
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Christophe Filliatre <Jean-Christophe.Filliatre@l...>
Subject: Re: [Caml-list] Quick question - accessing variant value from C


You can use the macros Is_long / Is_block to discriminate between Null
and Address, since the first one  is represented as an integer and the
second one  as a  structured block  (in the later  case, you  can then
access the string with the Field macro).

Hope this helps,
Jean-Christophe FILLIATRE

David Fox writes:
 > I have a value of the following type being passed to an external:
 >   type pointer = Null | Address of string
 > and I'd like to determine (in the C code) which variant the value is
 > and get the pointer to the string.  I've stared at mlvalues.h for a
 > while, but I can't really figure it out.  Can anyone help?  You won't
 > regret it...
 > -------------------
 > To unsubscribe, mail  Archives:
To unsubscribe, mail  Archives: