.dll question

Dan Kegel dank@kegel.com
Mon Apr 21 02:20:00 GMT 2003


David Starks-Browning wrote:
>>>	On a related note, can Cygwin generate c++ .dlls which are loadable by msvc++ or 
>>>does Microsofts'  method of name mangling prohibit such things?
>>
>>No it can't. In general, C++ compilers don't interoperate. The C++-Lite
>>FAQ has a section on this.
>>
>>>From memory, the issues are:
>>*name mangling
>>*VMT layout
>>*new[] management
>>*exception handling
>>
>>If you want to use cygwin C++ from MSVC, write some C bindings for the
>>code.
> 
> ... All the FAQ says about this is the following:
> 
>   Q.  Can I mix objects compiled with msvc++ and gcc?
> 
>   A.  Yes, but only if you are combining C object files. MSVC C++ uses
>       a different mangling scheme than GNU C++, so you will have
>       difficulties combining C++ objects.
> 
> I'd like to include the extra detail that Robert goes into, if it's
> correct.  Does anyone know for sure?

Any discussion of these issues isn't complete without mentioning
the fact that you can't even mix objects compiled by gcc2.x
and gcc3.x.  This was caused by the switchover as of gcc3.x to the standard
C++ ABI defined at http://www.codesourcery.com/cxx-abi/
That document defines very carefully all the issues Robert writes
about, I think.  All C++ compilers for Linux should now be following
that standard.  See also http://gcc.gnu.org/gcc-3.2/c++-abi.html

Also, I have some extra detail about name mangling in MSVC6 and gcc2.x
at http://www.kegel.com/mangle.html
It's three years old but may still be useful.

- Dan

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list