Creating .dll and .lib files with the VC++ command line

后端 未结 2 555
独厮守ぢ
独厮守ぢ 2020-12-23 07:57

How can I create .lib files and .dll files in VC++ with cl.exe from the command line?

相关标签:
2条回答
  • 2020-12-23 08:19

    Visual Studio comes with a library tool called LIB.EXE which can be used to create library files from object files. If you set up the command line so that you have CL.EXE on the path, you should also be able to run LIB.EXE.

    E.g.

    LIB.EXE /OUT:MYLIB.LIB FILE1.OBJ FILE2.OBJ
    

    To create a dll, you just use LINK.EXE (as for executables) but with the /DLL switch.

    E.g.

    LINK.EXE /DLL /OUT:MYLIB.DLL FILE3.OBJ FILE4.OBJ
    
    0 讨论(0)
  • 2020-12-23 08:20

    Re making a DLL, these are shorthand form(s) if you have the source files:

    cl /LD foo.c bar.c baz.c /FeMyImage.dll
    

    or

    cl /LD foo.c bar.c baz.c /link /out:MyImage.dll
    

    are equivalent.

    0 讨论(0)
提交回复
热议问题