Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] adding an ocaml interpreter to my C program
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-01-07 (16:51)
From: Damien Doligez <damien.doligez@i...>
Subject: Re: [Caml-list] adding an ocaml interpreter to my C program
> 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 Archives:
Bug reports: FAQ:
Beginner's list: