Auto Linking
#pragma comment (lib, "...") and #pragma link "..." both enable Auto-Linking. They differ in the default extension when none is specified. It is important to note that the logic only supports short extensions: i.e. extensions of 3 letters or less.
When no extension is specified #pragma link "..." defaults to .obj and .o for Win32 and Win64 respectively. #pragma comment(lib, "...") defaults to .lib and .a for Win32 and Win64 respectively.
The table below illustrates.
Pragma | File Auto-Linked WIN32 | File Auto-Linked WIN64 | Notes |
---|---|---|---|
#pragma link "Network.util" | "Network.util.obj" | "Network.util.o" | |
#pragma link "Network.util.os" | "Network.util.os" | "Network.util.os" | The .os is treated as the extension |
#pragma comment (lib, "Network.util") | "Network.util.lib" | "Network.util.a" | |
#pragma comment (lib, "Network.util.os") | "Network.util.os" | "Network.util.os" | The .os is treated as the extension |