This is the mail archive of the cygwin mailing list for the Cygwin 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]

Re: Creating DLL's for use with MSVC


Brian Ford wrote:

Because it took me 20 minutes to dig back through the list archives and
find the set of posts that confused me :^\?  I still don't think I found
all of them.

With C++, the problem is that it's not just a matter of matching the mangling scheme - it's a matter of matching the MS VC++ compiler's object layout scheme *exactly*, including virtual table layouts.


The virtual table layout algorithm for GCC is shared across all implementations, and is incompatible with MSVC's. And IIRC, MSVC's virtual table layout scheme is patented (they play some clever tricks to avoid having to have split virtual tables with multiple inheritance, using inbound and outbound stubs to match object offsets), so it might not even be possible for GCC to ever emulate it exactly.

So simply genererating a different kind of mangling may (will) not be enough.

Basically, if you want to mix C++ objects from *any* two vendors, you have to use 'extern "C"'. The cardinal, and simple, rule of C++ APIs is never to export C++ symbols directly.

Both the Sun JVM and NSAPI programmers blew this badly, and as a result, have historically had all sorts of trouble with mixing compiler versions.

--
Shankar.


-- 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/


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