Convert GCC under Cygwin Name Mangling to VC++ Name Mangling
Michael Haubenwallner
michael.haubenwallner@salomon.at
Thu Dec 14 08:48:00 GMT 2006
Hi Francisco,
as you said you have a shared-library initially built on Linux, I assume
you have some gcc-bound build mechanism (ev. autotools+libtool ?), which
is why you started using gcc on cygwin, right ?
And very likely, you include some system headers not available on
Windows (fex unistd.h) ?
I'm sure it is worth a try to look at 'wgcc', which is a full featured
wrapper around MS 'cl.exe', behaving like gcc as much as possible,
including the ability to build shared libraries, but using MS 'cl.exe'
as the underlying compiler: http://sourceforge.net/projects/interix-wgcc
We are able to build a bunch of opensource packages with cl.exe (through
wgcc) both as static and shared libraries, using their normal build
procedure (mostly automake+autoconf+libtool+GNU make), with minimal
sourcecode changes.
While the build environment is cygwin or interix (eventually MinGW), the
output is real plain windows without the need for any cygwin1.dll or
psxdll.dll.
/haubi/
On Wed, 2006-12-13 at 19:42 +0100, Francisco J. Royo Santas wrote:
> Quoting John Love-Jensen <eljay@adobe.com>:
>
> > Hi Francisco,
> >
> > Given your situation, it sounds like the bigger project is using MS Dev
> > Studio's Visual C++.
> >
> > The GCC C++ ABI is not compatible with the MS Dev Studio VC++ ABI.
> >
> > Either the bigger project will need to be compiled with GCC, or your
> > package-made-for-Linux will have to be compiled with MSVC++, or you will
> > have to create a C ABI edge that is the interface from the GCC C++ world to
> > the MSVC++ world.
> >
> > The C ABI is compatible between the two compilers. The C++ ABIs are not
> > compatible.
> >
> > What does "not compatible ABI" mean in this context? The RTTI is
> > incompatible, the exception handling is incompatible, the name mangling is
> > incompatible, the parameter pushing is incompatible, the calling convention
> > is incompatible, the stack clean up is incompatible, the stack unwinding is
> > incompatible, and probably a handful of other catastrophic differences.
> >
> > If you write a C edge, you cannot leak RTTI information, or throw an
> > exception past the C barrier (instant program termination), et cetera.
> >
> > HTH,
> > --Eljay
> >
> >
>
>
> Oh :(:( Thank you very much anyway, I hoped it could be possible. How
> can I do a
> C edge for a C++ class? This class has 6 or 7 variables of types which are
> defined inside the DLL so it's a bit complicated because the functions I need
> to use in the class make use of these variables which have to be
> initialized at
> the beginning of the execution and it takes a long time (10 seconds)
> while the function takes less than 0.03 seconds. Time is important. If
> everything fails,
> I will have to create a socket to communicate a gcc-compiled program with the
> big VC++-compiled big project but I want to try everything before changing to
> this solution.
>
> Thanks and g'bye
>
--
Michael Haubenwallner SALOMON Automation GmbH
Forschung & Entwicklung A-8114 Friesach bei Graz
mailto:michael.haubenwallner@salomon.at http://www.salomon.at
No HTML/MIME please, see http://expita.com/nomime.html
More information about the Gcc-help
mailing list