From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA13470 for caml-redistribution@pauillac.inria.fr; Wed, 19 Apr 2000 14:00:49 +0200 (MET DST) Resent-Message-Id: <200004191200.OAA13470@pauillac.inria.fr> Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id VAA32692 for ; Mon, 17 Apr 2000 21:24:41 +0200 (MET DST) Received: from isil.localdomain (isil.maya.com [192.70.254.5]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id VAA15691 for ; Mon, 17 Apr 2000 21:24:36 +0200 (MET DST) Received: by isil.localdomain (Postfix, from userid 1000) id 08E8736ACB; Mon, 17 Apr 2000 15:25:36 -0400 (EDT) Sender: prevost@isil.localdomain To: Ohad Rodeh Cc: caml-list@inria.fr Subject: Re: Calling C++ from Caml References: From: John Prevost Date: 17 Apr 2000 15:25:36 -0400 In-Reply-To: Ohad Rodeh's message of "Sun, 16 Apr 2000 16:40:44 +0300 (IDT)" Message-ID: <871z44lebz.fsf@isil.localdomain> User-Agent: Gnus/5.0804 (Gnus v5.8.4) Emacs/20.5 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-From: weis@pauillac.inria.fr Resent-Date: Wed, 19 Apr 2000 14:00:49 +0200 Resent-To: caml-redistribution@pauillac.inria.fr >>>>> "or" == Ohad Rodeh writes: or> Hello, I'm trying to use C++ code from within Caml. Currently, or> the compiler cannot find the requested functions in the or> compiled C++ code. {...} or> If I use the gcc compiler with C code, instead of C++, this or> sequence works fine. How can I fix this problem? C++ compilers need to do "name-mangling" in order to support overloading functions. This adds information about the types of the arguments to the function's name, and makes it hard for O'Caml to find. I suspect that using the following prototype would work for you: extern "C" { value dhml_Try(value dummy); } the `extern "C"' part requests that the following be done with C calling conventions. I'm not up on my C++, so this may be insufficient when you're defining the function in the current file--you may need to use the extern declaration around the function's definition. John.