From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 1EC7ABBBC for ; Fri, 24 Feb 2006 00:03:42 +0100 (CET) Received: from serv07.divms.uiowa.edu (serv07.divms.uiowa.edu [128.255.44.97]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k1NN3exf025981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Fri, 24 Feb 2006 00:03:41 +0100 Received: from [63.254.135.37] (alexander@63-254-135-37.xwires.net [63.254.135.37]) by serv07.divms.uiowa.edu with id k1NN3YuI008004 for ; Thu, 23 Feb 2006 17:03:36 -0600 Message-ID: <43FE3F42.9020802@cs.uiowa.edu> Date: Thu, 23 Feb 2006 17:03:30 -0600 From: Alexander Fuchs User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: C Interface - Native-Code / Bytecode Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.55 on 128.255.44.22 X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on serv07.divms.uiowa.edu X-Virus-Status: Clean X-Miltered: at nez-perce with ID 43FE3F4C.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; uiowa:01 native-code:01 bytecode:01 ocaml:01 c-library:01 native-code:01 bytecode:01 compilation:01 diverges:01 ocaml:01 camlparam:01 camlreturn:01 extern:01 3.09.0:01 compilation:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 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