English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2001-09-19 (09:55)
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: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr