From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32229 invoked by alias); 26 Sep 2005 20:00:17 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 32052 invoked by uid 22791); 26 Sep 2005 19:59:55 -0000 Received: from xproxy.gmail.com (HELO xproxy.gmail.com) (66.249.82.204) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Mon, 26 Sep 2005 19:59:55 +0000 Received: by xproxy.gmail.com with SMTP id i26so1389828wxd for ; Mon, 26 Sep 2005 12:59:53 -0700 (PDT) Received: by 10.70.37.6 with SMTP id k6mr2458941wxk; Mon, 26 Sep 2005 12:59:53 -0700 (PDT) Received: by 10.70.34.16 with HTTP; Mon, 26 Sep 2005 12:59:53 -0700 (PDT) Message-ID: Date: Mon, 26 Sep 2005 21:41:00 -0000 From: Nick Glencross Reply-To: Nick Glencross To: Max Bowsher , cygwin@cygwin.com Subject: Re: Visibility of compiler symbols between executables and DLLs In-Reply-To: <279601c5c27a$cc315170$5304a8c0@chimaera> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <279601c5c27a$cc315170$5304a8c0@chimaera> X-SW-Source: 2005-09/txt/msg00899.txt.bz2 Max, Thanks, that's the conclusion that I had come to. On other UNIX-based platforms it's possible without actually linking with the .exe, provided you have compiled with the right flags (-shared on Linux, or -E on HP-UX). With this done the .exe exposes its global symbols to subsequently loaded libraries which can then import them. Looks like DLLs are are more restrictive, but I couldn't find anything documented about it for cygwin. Thanks, Nick On 9/26/05, Max Bowsher wrote: > 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 th= at > 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/