3

Why is it not possible to implicitly link against a .DLL without providing the respective import .LIB?

Whats inside of an import .LIB that the linker can't take directly out of the .DLL during build time?

When I use dumpbin /EXPORTS on my DLL, it prints me out everything what should be needed to create the function stubs within the binary which is linking against the DLL:

    ordinal hint RVA      name
      1    0 00001040 ?MyFunc@@YGKHPADAAK@Z = ?MyFunc@@YGKHPADAAK@Z (unsigned long __stdcall MyFunc(int,char *,unsigned long &))
  • Entry point
  • Ordinal
  • Function Name
  • Signature incl. return type and Arguments

Here someone even manually created the import .lib by himself, while only having the .dll at his disposal. Why can't the Microsoft Compiler do that for us?

Are there (maybe historical) reasons why this additional versioning effort was created? -You already have to maintain the header which defines the symbols you want to use.

Would be very grateful if someone could explain this to me, since these questions boggle my mind.

Allgaeuer
  • 725
  • 1
  • 7
  • 12
  • Microsoft's [LIB tool](https://learn.microsoft.com/en-us/cpp/build/reference/lib-reference?view=vs-2019) can be used to create an import library from a DLL. – john Aug 05 '20 at 08:07
  • 1
    Does [this](https://stackoverflow.com/questions/56085753/why-do-we-need-lib-file-in-case-of-importing-functions-from-dll) answer your question? I found the second answer (with only one vote) more to the point. – john Aug 05 '20 at 08:39
  • It **is** possible to link a DLL directly, without import library, it depends on the linker. For instance https://flatassembler.net/ or https://euroassembler.eu/eadoc/#EaFnLink do that. – vitsoft Aug 06 '20 at 08:23

0 Answers0