From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA24154; Wed, 7 Jan 2004 17:51:33 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA25196 for ; Wed, 7 Jan 2004 17:51:33 +0100 (MET) Received: from inria.fr (macaque.inria.fr [128.93.8.158]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i07GpW504085 for ; Wed, 7 Jan 2004 17:51:32 +0100 (MET) Date: Wed, 7 Jan 2004 17:51:51 +0100 Subject: Re: [Caml-list] adding an ocaml interpreter to my C program Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v553) From: Damien Doligez To: caml-list@inria.fr Content-Transfer-Encoding: 7bit In-Reply-To: <20040107160452.GA22783@redhat.com> Message-Id: X-Mailer: Apple Mail (2.553) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 damien:01 damien:01 runtime:01 ocamlopt:01 macosx:01 otherlibs:01 ocaml:01 ocaml:01 caml:01 caml:01 doligez:01 doligez:01 interfaces:01 simpler:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Actually, perhaps I didn't describe it too well, but the OCaml case is > probably quite a bit simpler than Perl. What would be really nice for > OCaml would be some way to have all the identifiers properly prefixed, > eg. with caml_ and CAML_. Even if was an optional > -DCAML_CLEAN_SYMBOLS or something, that would be a huge help. Just check out the CVS version. I spent some of my Christmas holidays implementing exactly that. Every global symbol exported by the runtime system now starts with "caml_", with the only exception of "main", and every global symbol produced by ocamlopt now starts with "caml". The change is transparent: any C source that interfaces with OCaml still works as before, thanks to a bunch of #defines in a new header file (compatibility.h), which is included from the other caml header files. In your code that uses the new names directly, you can #define CAML_NAME_SPACE before including the header files, and then compatibility.h is not included. I may have broken some of the native-code ports in the process, so if you have one of the more exotic architectures, please try the CVS version and report any problems you find. It was tested on PPC/MacOSX, i386/Linux, alpha/Tru64Unix, and IA64 (I don't know which OS). We still need to do it to the pieces of C code in otherlibs. We haven't done it for the macros, because name space pollution is much less problematic at that level. -- Damien ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners