How to link a .DLL statically?

后端 未结 4 1964
庸人自扰
庸人自扰 2020-12-09 15:35

We have a (pure native C++) .DLL that is build by VS. As clients we have some native C++ applications and a .Net-Wrapper around this DLL written in C++/CLI. Finally there ar

相关标签:
4条回答
  • 2020-12-09 16:10

    You can generate a dll and export the entry point to a lib using dllexport, this is explained here

    http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx

    0 讨论(0)
  • 2020-12-09 16:17

    Pick up a copy of DLL to Lib (Edit: If you can't find a cheaper option)

    0 讨论(0)
  • 2020-12-09 16:23

    Another option is to have two projects, one project will output a .lib which can be statically linked, and a second project which will output a .dll and will have your .lib as dependency, you should add .def to your .dll with the symbols that you are planning to export, or else it will be empty.

    0 讨论(0)
  • 2020-12-09 16:25

    In the C++ project file for the dll, create two configurations, one that generates a DLL and one that generates a .lib. Two projects are not necessary, since any .NET/C++ project can support multiple build configurations (this is how Release and Debug versions build differently).

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