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
C Interface - Native-Code / Bytecode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-02-23 (23:03)
From: Alexander Fuchs <fuchs@c...>
Subject: C Interface - Native-Code / Bytecode

I have a problem with an OCaml program that links to a C-library via a 
C++ wrapper. In essence, the behavior of the C part is different when 
using native-code or bytecode compilation. It seems like the content of 
some variables diverges at some point. There are no calls from C to 
OCaml, yet.

Now, this might be a problem with the ownership of the memory between 
C/C++ and OCaml. But as far as I can tell from the manual, all the 
CAMLparam, CAMLlocal, and CAMLreturn calls are in place in the C++ 
wrapper, plus all C++ functions used by C and OCaml are declared as 
extern "C".

I get this behavior with ocaml 3.09.0 (Debian) and 3.09.1 (Redhat), with 
static and dynamic linking. I use OCamlMakefile to manage the compilation.

Does perhaps someone have an idea what might cause this different 
behavior in native and bytecode? Is there anything special to watch when 
using a C++ file?