public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
* How is cygwin1.dll linked in?
@ 2021-11-19 14:38 Kacvinsky, Tom
  2021-11-20 15:23 ` Jon Turney
  0 siblings, 1 reply; 2+ messages in thread
From: Kacvinsky, Tom @ 2021-11-19 14:38 UTC (permalink / raw)
  To: cygwin-developers

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 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
sure of this.

Any help on this matter would be appreciated.

Tom


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How is cygwin1.dll linked in?
  2021-11-19 14:38 How is cygwin1.dll linked in? Kacvinsky, Tom
@ 2021-11-20 15:23 ` Jon Turney
  0 siblings, 0 replies; 2+ messages in thread
From: Jon Turney @ 2021-11-20 15:23 UTC (permalink / raw)
  To: Tom.Kacvinsky, cygwin-developers

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-20 15:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 14:38 How is cygwin1.dll linked in? Kacvinsky, Tom
2021-11-20 15:23 ` Jon Turney

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