Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , 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 Subject: Re: Creating DLL's for use with MSVC Date: Wed, 10 Mar 2004 14:11:10 -0800 Lines: 29 Message-ID: References: <20040310152944 DOT GB5318 AT redhat DOT com> <20040310160707 DOT GE5318 AT redhat DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: 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/