This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AW: c++ name mangling question

> -----Ursprüngliche Nachricht-----
> Von: mike stump []
> Gesendet am: Donnerstag, 15. November 2001 19:16
> An:
> Betreff: RE: c++ name mangling question
> > From: "Ralf Habacker" <>
> > To: <>
> > Date: Thu, 15 Nov 2001 10:48:30 +0100
> > Disposition-Notification-To: "Ralf Habacker" <>
> > > Read the fine manual:
> > >
> > > "GNU C++ does not do name mangling in the same way as other C++ compilers.
> > > This means that object files compiled with one compiler cannot be
> used with
> > > another.
> > > This effect is intentional, to protect you from more subtle problems.
> > > Compilers differ as to many internal details of C++ implementation,
> > > including: how class instances are laid out, how multiple inheritance is
> > > implemented, and how virtual function calls are handled. If the name
> > > encoding were made the same, your programs would link against libraries
> > > provided from other compilers--but the programs would then crash when run.
> > > Incompatible libraries are then detected at link time, rather than at run
> > > time."
> > >
> > I have read this already, but why should not now the time is coming to break
> > this wall :-)
> We have, the documentation is out of date.  There is an ABI for C++,
> we are working to follow it, we do for the most part.  If another
> vendor's compiler doesn't follow it, well, take it up with them.
Hmmh, but this only work If I have the source of the related code. There are
cases, in which this not work like native dll's for windows produced by for
example msvc.

Can you tell me, where I can find more information about this ?

Additional I like to tell some background for my questions:

In April I have started porting kde to windows with cygwin and xfree.
You can find this port on

One target in this project is to enable a native running kde on windows.
KDE is based on qt, the multi platform gui framework from trolltech
Trolltech releases a free x11 version, which is available as source.
So porting to other x11 environment is relative easy. If habe done so for
with qt 1.4.5, qt.2.3 and currently working on the qt3 port.
On Windows trolltech has released only a non commercical lib for msvc++.
At first I have thinked about porting the x11 version to windows. This is much
work and enables only one c++ lib windows.
So I have thinked about a more general way to use windows native c++ (especially
mscv++) libs, additional because I have recognized some requests for this on the
cygwin mailing lists. Ever and ever I have heard, that this is not possible.

So I have thinked about a possible way to link msvc++ libs and like to get some
comments, if this might be possible:

1. the binutils tool should be able to handle msvc c++ symbole name.
   This in on the way

A2. A special import tool has to be created, that creates
   import libraries for msvc++ dll's with the following feature:
   A2.1 converting msvc symbol names to g++ symbol names
	A2.1.1 demangling msvc++ names (solved)
	A2.1.2 creating g++ style mangled names
   A2.2 creating code thunks for different register/stack/vtable layouts


B2. A special import tool has to be created, that creates
   import libraries for msvc++ dll's with the following feature:
   2.1 converting msvc symbol names to g++ symbol names
	2.1.1 demangling msvc++ names (solved)
	2.1.2 creating g++ style mangled names

B3 Extending g++ (cc1) to create the specific stuff based
        on a include directory based decision
   B3.1 handling register/stack/frame layout
   B3.2 calling contructor/destructor for object creation/destroying
   B3.3 handling specific vtables
   B3.4 handling inheritance
   B3.5 handling rtty ?
   B3.6 exception handling ?
   B3.7 have I forgotten something ?

   Note: Currently I don't have very deep knowledge about how g++ this handles,
	  but I have developed an embedded debugger with c++ support, So I know
	  the basics.


Ralf Habacker

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]