How to build a DLL from the command line in Windows using MSVC

后端 未结 5 2023
时光说笑
时光说笑 2020-11-29 22:28

I\'ve been doing C for about 20 years but I\'ve never built a DLL; I\'ve always prefered to statically link.

I use the command line - cl.exe, etc - and gnumake makef

5条回答
  •  时光说笑
    2020-11-29 22:55

    Simlar to Ebow Halm's answer, but using a .def file for listing the exported functions and newer command line arguments:

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat" && cl /O2 /Iall /Iyour /Iincludes /D_USRDLL /D_WINDLL /DOTHER_DEFINES   /LD /Fe /link /DEF:.def
    

    References:

    • https://msdn.microsoft.com/en-us/library/34c30xs1.aspx
    • https://msdn.microsoft.com/en-us/library/19z1t1wy.aspx

提交回复
热议问题