www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/03/10/17:17:09

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
From: Shankar Unni <shankarunni AT netscape DOT net>
Subject: Re: Creating DLL's for use with MSVC
Date: Wed, 10 Mar 2004 14:11:10 -0800
Lines: 29
Message-ID: <c2o3pv$dj9$1@sea.gmane.org>
References: <D9B6A11B-7268-11D8-B092-000393C92B12 AT foi DOT se> <c2mv33$u1m$1 AT sea DOT gmane DOT org> <DEA1FE60-7295-11D8-B092-000393C92B12 AT foi DOT se> <20040310152944 DOT GB5318 AT redhat DOT com> <Pine DOT GSO DOT 4 DOT 58 DOT 0403100934130 DOT 25622 AT thing1-200> <20040310160707 DOT GE5318 AT redhat DOT com> <Pine DOT GSO DOT 4 DOT 58 DOT 0403101030490 DOT 25622 AT thing1-200>
Mime-Version: 1.0
X-Complaints-To: usenet AT sea DOT gmane DOT org
X-Gmane-NNTP-Posting-Host: adsl-64-165-207-59.dsl.snfc21.pacbell.net
User-Agent: Mozilla Thunderbird 0.5 (Windows/20040207)
In-Reply-To: <Pine.GSO.4.58.0403101030490.25622@thing1-200>

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019