www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/08/30/10:14:34

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
content-class: urn:content-classes:message
MIME-Version: 1.0
X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0
Subject: RE: Dll linking problem
Date: Fri, 30 Aug 2002 16:14:21 +0200
Message-ID: <C62850957C88154CB1C6CE03DE335E8B397CBA@mailstgeorgen.gft.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: =?iso-8859-1?Q?=22Schaible=2C_J=F6rg=22?= <Joerg DOT Schaible AT gft DOT com>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id g7UEEXm02946

Hi Preeti,

> A dll written using VC++ environment is exporting a complete class.
> The same is being accessed through cygwin, but it is unable to link to
> the class functions.
> However if the functions are declared inline in the dll, cygwin
> application is able to link successfully with the class functions.
> 
> The same dll can be accessed successfully through a program written in
> VC++ environment.
> 
> Please let me know if anyone can suggest an analysis or a solution.

Since the functions are inline, every compilation unit has its own version and the linker removes any duplicates for the execution unit. If the compiler is smart enough (or the functions easy enough) the code of the function is included everywhere the inlined function is called increasing space gaining speed. The result is either no explicit function at all (because the code is "inlined") or each execution unit (dll or executable) has its own set of functions.

You will get problems if not all of the functions are inline or the compiler ignores the "inline" (which is just a suggestion for the compiler, no strict commend). If one function is not inline, the linker will try to call the function in the DLL which fails, since the linker symbol generation of C++ symbols is not standardized (well, not only the name, but also at which position the implicit "this" parameter is provided, how the internal data layout for the class is realized and how the vtable is implemented). Another problems are thrown execptions from the DLL.  There is also no standardized way how they are implemented.  The standard just defines how they have to work!

==> DO NOT TRY LINK C++ DLL's FROM DIFFERENT COMPILERS!

Regards,
Jörg

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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