public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Max Bowsher" <maxb@ukf.net>
To: "Nick Glencross" <nick.glencross@gmail.com>, <cygwin@cygwin.com>
Subject: Re: Visibility of compiler symbols between executables and DLLs
Date: Mon, 26 Sep 2005 09:42:00 -0000	[thread overview]
Message-ID: <279601c5c27a$cc315170$5304a8c0@chimaera> (raw)
In-Reply-To: <dcb629180509260139f2440c1@mail.gmail.com>

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/

  reply	other threads:[~2005-09-26  9:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-26  9:32 Nick Glencross
2005-09-26  9:42 ` Max Bowsher [this message]
2005-09-26 10:22   ` Brian Dessent
2005-09-26 13:40     ` Christopher Faylor
2005-09-27  0:43     ` Charles Wilson
2005-09-26 21:41   ` Nick Glencross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='279601c5c27a$cc315170$5304a8c0@chimaera' \
    --to=maxb@ukf.net \
    --cc=cygwin@cygwin.com \
    --cc=nick.glencross@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).