delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/26/05:15:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/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
Message-ID: <279601c5c27a$cc315170$5304a8c0@chimaera>
From: "Max Bowsher" <maxb AT ukf DOT net>
To: "Nick Glencross" <nick DOT glencross AT gmail DOT com>, <cygwin AT cygwin DOT com>
References: <dcb629180509260139f2440c1 AT mail DOT gmail DOT com>
Subject: Re: Visibility of compiler symbols between executables and DLLs
Date: Mon, 26 Sep 2005 10:14:29 +0100
MIME-Version: 1.0
X-IsSubscribed: yes

Nick Glencross wrote:
> Guys,
>
> I've done some research on this and don't believe that it's a
> perennial question that keeps coming up!
>
> On many platforms compilation symbols in an executable are not made
> visible to its Shared Library/DLLs by default, but this can often be
> overridden with a compiler flag to change the policy. My question in a
> nutshell then is whether cygwin has the ability to have a DLL access a
> global variable within the executable that loads it? As an obvious
> follow on, if yes, then how do you go about doing it?
>
> Everything that I've seen indicates that this isn't possible, due to
> limitations imposed by DLLs, but would appreciate believing this with
> a bit more confidence,

I'm fairly sure that it is impossible. Actually, it might be possible if 
there was a flag to convice GCC to add an import table to the built .exe, 
but last time I investigated that, there was no such flag. But even if that 
was possible, the .dll would need to explicitly link against the .exe that 
was to load it, for this method to work.

The standard workaround is to put whatever symbols both the .exe and the 
.dll both need access to into a second .dll, which both of the original 
components then link against.

Interestingly, the difficulties created by DLLs are at least slightly 
similar to those created by OS X two-level-namespace linking.


Max.


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