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
Re: [Caml-list] C ffi issue
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Damien Doligez <Damien.Doligez@i...>
Subject: Re: [Caml-list] C ffi issue
>According to the C interface documentation, assignments to tuple
>members must be done with the modify(value*,value) function.
>However, local variables once registered with the GC can apparently
>just be assigned.  If I do this instead will anything crash?
>        CAMLlocal1(nontuple);
>        modify(&nontuple,mydata);  // should just be nontuple=mydata;

Although it was not designed for this use, modify will work correctly
in this context.  I now guarantee that it won't crash if you use it in
this way.  It is a bit less efficient than direct assignment
(it does a little pointer arithmetic plus a memory read and a
conditional branch).

-- Damien
Bug reports:  FAQ:
To unsubscribe, mail  Archives: