public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: Tom.Kacvinsky@vector.com, cygwin-developers@cygwin.com
Subject: Re: How is cygwin1.dll linked in?
Date: Sat, 20 Nov 2021 15:23:45 +0000	[thread overview]
Message-ID: <f56bd054-e4d9-3b57-0462-a1a07340ba6b@dronecode.org.uk> (raw)
In-Reply-To: <AM0PR01MB4755F5C69DD4BADBB229297B8D9C9@AM0PR01MB4755.eurprd01.prod.exchangelabs.com>

On 19/11/2021 14:38, Kacvinsky, Tom wrote:
> I built the base Cygwin (really, just cygwin1.dll` and then went to compile
> a test problem.  I did not see an import library for cygwin1.dll. so I am of

The import library is libcygwin.a

(technically this is a hybrid import/static library)

> the opinion there is "magic" for doing this.  Is that magic the .idata section?
> I _think_ the .data section is what passed on imported functions to the DLL
> and adds it to the run time dependencies of the executable, but I am not

I don't quite understand what this is saying.

The .idata section (strictly, the Import Directory) is used by the 
Windows PE loader to determine which DLLs to load, and to fixup 
references to imported symbols.

See 
https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section

> sure of this.
> 
> Any help on this matter would be appreciated.

I think maybe that answer to your question is that this is done via the 
gcc specs file, which you can examine using `gcc -dumpspecs'

This contains:

*lib:
   %{pg:-lgmon}   %{pthread: }   -lcygwin   %{mwindows:-lgdi32 
-lcomdlg32}   %{fvtable-verify=preinit:-lvtv -lpsapi; 
fvtable-verify=std:-lvtv -lpsapi}   -ladvapi32 -lshell32 -luser32 -lkernel32

which means that -lcygwin (and others) are passed to the linker.

See https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html for more details.

      reply	other threads:[~2021-11-20 15:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-19 14:38 Kacvinsky, Tom
2021-11-20 15:23 ` Jon Turney [this message]

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=f56bd054-e4d9-3b57-0462-a1a07340ba6b@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=Tom.Kacvinsky@vector.com \
    --cc=cygwin-developers@cygwin.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).