How is cygwin1.dll linked in?
Jon Turney
jon.turney@dronecode.org.uk
Sat Nov 20 15:23:45 GMT 2021
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.
More information about the Cygwin-developers
mailing list