Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 872 Bytes

README.md

File metadata and controls

20 lines (15 loc) · 872 Bytes

Delay Loading DLLs in MinGW

The Microsoft linker link.exe supports delay loading DLLs until a function from the DLL is call. See this documentation about the /DELAYLOAD: command line argument.

The GNU linker ld does not have, to the best of my knowledge, a similar command line argument.

To work around this limitation, we instead use the binutils program dlltool. See the documentation. This program is usually used for creating new DLLs. We instead create a delay load library for an existing DLL.

This example

This example shows delay loading the Windows DLL version.dll. We call the GetFileVersionInfoW function. We also include a delay load hook so that we can observe the DLL being delay loaded.