Re: interface to C++

Jean-Marie Geffroy (geffroy@cornas.inria.fr)
Wed, 20 Sep 1995 14:43:16 +0200

Date: Wed, 20 Sep 1995 14:43:16 +0200
Message-Id: <199509201243.AA20588@cornas.inria.fr>
From: Jean-Marie Geffroy <geffroy@cornas.inria.fr>
To: stefan.monnier@epfl.ch
In-Reply-To: <7751.811598499@lia.di.epfl.ch> (stefan.monnier@epfl.ch)
Subject: Re: interface to C++

Stefan Monnier <stefan.monnier@epfl.ch> wrote

> Rather than mess around with the mangled names, you might be better
> off trying to compile caml-light with your C++ compiler so that the
> name (de)mangling is all done by your compiler. Since C++ is an
> approximate superset of ANSI C, it might work.

Right. The Windows version (1) is in fact already compiled this way:
the standard caml system is written in pure C but compiled with a C++
compiler. The graphical interface is written in C++ and uses the
MFC. It exports 5 or 6 functions through extern "C" declarations such
as:

extern "C" ui_xxx(...){...}

The C modules contain standard extern declarations:

extern ui_xxx(...);

Linking C++ functions is thus completely straightforward and there's no
messing around with names.

Hope this helps !

Jean-Marie

(1) soon available !