I am using VS 2005. First I create .lib project and prepare one application project. Both are running fine.
Then i change the .lib project in to .dll project. It compiles fine but when i compile the application project it shows one issue [fatal error LNK1104 :: can not open the lib file]. My question is how i will link to .dll file correctly. Please give me the settings change for application project.
You still need .lib file for linking - add it to the list of linker dependencies. .lib file in this case is used as "proxy" which helps to open dll at runtime.
Without .lib file, you can use LoadLibrary/GetProcAddress.
If you don't want .lib, exclude it from the linker list, and use LoadLibrary/GetProcAddress.
If you want .lib, add it to the linker list and ensure that linker can find it (by providing full path, or adding .lib path to the list of linker directories, or by placing .lib file to the project directory.
See Project - Properties - Configuration Properties - Linker.
General - Additional Library Directories. Here you can add the path where abc.libfile is placed.
Input - Additional Dependencies. Type abc.lib here.
Even if you want to use a DLL at runtime, the linker still has to know where to find the functions in the DLL. Thus the corresponding .lib file is needed. That does not mean your app is statically linked with the .lib, the app is just "prepared" to use the DLL.
Bookmarks