Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: interface to C++
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jean-Marie Geffroy <geffroy@c...>
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 !