[Ecls-list] Urgent -- seek patches for C++ support

Alexander S A Kjeldaas Alexander.Kjeldaas at fast.no
Mon Dec 17 10:26:02 UTC 2001


On Mon, Dec 17, 2001 at 05:56:55PM +0100, Juan Jose Garcia-Ripoll wrote:
> Alexander S A Kjeldaas wrote:
> > 
> > On Mon, Dec 17, 2001 at 11:37:23AM +0100, Juan Jose Garcia-Ripoll wrote:
> > > Hi,
> > >
> > > not long ago, somebody on this list sent me a set of patches for making
> > > ECL compile using g++, the C++ compiler. I have changed my location
> > > twice and in the process I have lost the few personal mails that I got
> > > during these days. Could that person please send me these patches again?
> > > I would like to finish that before Xmas gets in the way and I have to
> > > switch country again :)
> > >
> > 
> > That would probably be me.  Beware, the patch isn't polished.  There
> > are a few things I'd like to fix, but I don't have the ECL source
> > handy at the moment:
> 
> I have been thinking about the way of implementing C++ compatibility. As
> far as I know (And I only developed C++ when it was on its infancy) C++
> allows one to link against C libraries, and to declare C functions using
> the 'extern "C" {}' construct.
> 
> >From my limited point of view, the fastest and simplest solution this
> days would be not to make ECL compile with g++, but to allow ECL to use
> object files which have been compiled with g++. This way lisp code would
> still be compiled using ANSI C, which is simpler and has a smaller
> amount of reserved keywords. In the final stage, when the executable is
> linked, one could supply object files which have been compiled with g++
> and let g++ perform the linking.
> 

You won't be able to call a C++ function from a function compiled by
gcc, so I don't see how this will work unless you create C-wrappers
for all C++ functions. 

To take full advantage of C++, you would want the compiled lisp files
to be able to #include a C++ header.  That will only work if you
compile using g++.  In my patch I made all ECL-produced output extern
"C" so that the name-mangling used by the C++ compiler is disabled, so
you can mix and match ECL object files compiled using gcc and g++.

> I have already fixed the headers so that they can be used from C++. The
> changes are the sames as you did, although there is nothing to change
> outside the headers --except for some function names.
> 


astor





More information about the ecl-devel mailing list