且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从托管C ++引用非托管C ++ DLL

更新时间:2023-02-12 16:38:18

您不能将非托管DLL作为对托管C ++项目的引用。你只能使用托管DLL。你所做的就是链接到非托管DLL,就像链接到非托管C ++项目中的非托管DLL一样:

You cannot add the unmanaged DLL as a reference to your managed C++ project. You can only do that with managed DLLs. What you do instead is link to the unmanaged DLL in the same way as you link to an unmanaged DLL in an unmanaged C++ project:


  • 使用

  • 将非托管DLL的.lib文件提供给链接器,例如将其添加到链接器中的附加依赖关系列表

  • 将DLL放在与可执行文件相同的目录中,以便加载器可以找到它。