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?
4 ответов
+ 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
+ 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..!
0
is it similar to this situation?
https://stackoverflow.com/questions/77256387/include-standard-libraries-with-cl-exe-in-vanilla-command-prompt
I have not really used cl.exe directly but this seems loke a good link
https://riptutorial.com/cplusplus/example/5959/compiling-with-visual-cplusplus--command-line-
You always come up with unusual situtations...😁
https://learn.microsoft.com/en-us/cpp/build/reference/compiler-options?view=msvc-170
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.