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
[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 (06:45)
From: Jeff Henrikson <jehenrik@y...>
Subject: [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?

	modify(&nontuple,mydata);  // should just be nontuple=mydata;

If this is bad, is there a performance efficient way to wrap modify so that I can assign to tuple members and local variables in
the same way?  I am writing a stub generator (language module for SWIG) and due to the way that the preexisting model works, it is
desirable to have this congruency.

The alternative of course is to allocate some tuples when I don't need to so that the modify function always gets what it expects,
and then throw them away when necessary.  This may be faster anyway, but if modify works out of the box I'll definitely take that.


Jeff Henrikson

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