how to have import lib generated with DLL + Windows command line | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

how to have import lib generated with DLL + Windows command line

Hi I am working on windows. I know cl.exe will be able to generate exe file and object file (with -c flag). object file can be used to link using cl.exe again. Additionally, obj file can be used with lib.exe to generate the static library. What my query is related to dll file generation. How to have dll file generated from obj file on windows? cl.exe with -LD generates DLL using obj files , but it misses to generate import library .lib file. How to achieve the same?

12th May 2024, 7:00 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
4 Réponses
+ 2
so you can compile it the way you want in with Visual Studio, with import .lib files, but you want to use cl.exe? Maybe there are problems in your compiler options set up? https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options?view=msvc-170
13th May 2024, 11:57 AM
Bob_Li
Bob_Li - avatar
+ 1
It was my mistake to have expectation of import lib generated using cl.exe I needed to use link.exe -dll a.obj file to get DLL with me. If a.cpp generating a.obj had at least one declspec statement like extern "C" __declspec(dllexport) void test() {} same command (link.exe -dll a.obj) will generate .exp , .lib along with .dll file Thank you Bob_Li for your help and support. Many thanks..!
13th May 2024, 3:35 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Import lib is not unusual thing to ask for. I am always on windows and dll project set up on visual studio generates lib and dll . It must be done in one or other way to get lib file along with dll which I am missing to get.
13th May 2024, 9:44 AM
Ketan Lalcheta
Ketan Lalcheta - avatar