English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 1995-09-20 (12:54)
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

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 !


(1) soon available !