Why implicitly link the lib file as well.
.Libs have information about importing DLLs, you can check the information using the dumpbin command, which is included in the Windows / Visual Studio SDK.
This is the recv link information inside ws2_32.lib, for example:
Version : 0 Machine : 14C (x86) TimeDateStamp: 4907F6ED Wed Oct 29 01:38:53 2008 SizeOfData : 00000014 DLL name : WS2_32.dll Symbol name : _recv@16 Type : code Name type : ordinal Ordinal : 16
You can check if there is a serial number and name inside ws2_32.dll (check what it says now to import the DLL).
What information needs to be extracted from the "Lib" file, which cannot be obtained from the DLL or the header file
There is no information in the header file about where to get the import, so when compiled they are marked as import (__imp__name), and when it is associated with .lib, it resolves the name:
- If it is inside .lib, it just refers to it.
- But if there is information about an external link (DLL), it will build the import inside the import table so that it loads dynamically.
If there is something for question 2, how is this information retrieved when explicitly loaded.
If you mean LoadLibrary for explicit loading, you talk about it at runtime, not at link time. Thus, the PE loader will look for the DLL inside the PATH and will load it dynamically. Then you have other functions to get the addresses of the exported functions.
If you donβt understand something, just ask me, try playing with dumpbin and read about PE if you want to understand it better.
snf
source share