<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2006/02/af620428b9e5973d1b1d679cf7d0bc61"
  from="Alexander Fuchs &lt;fuchs@c...&gt;"
  author="Alexander Fuchs"
  date="2006-02-23T23:03:42"
  subject="C Interface - Native-Code / Bytecode"
  prev="2006/02/02afb32cb15cb612c47d0d5dc141db6c"
  next="2006/02/15202f64dadd29700ecfd2c0a70cfe23"
  prev-thread="2006/02/f908dcb156bd0fb005460b3a0e333f44"
  next-thread="2006/02/03685ae260718d8812c6a6f0bb6dd87d"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="C Interface - Native-Code / Bytecode">
<msg 
  url="2006/02/af620428b9e5973d1b1d679cf7d0bc61"
  from="Alexander Fuchs &lt;fuchs@c...&gt;"
  author="Alexander Fuchs"
  date="2006-02-23T23:03:42"
  subject="C Interface - Native-Code / Bytecode">
</msg>
</thread>

<contents>
Hi,

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?


Thanks,
	Alex

</contents>

</message>

