且构网

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

在 Visual Studio 2010 C++ 中使用 .dll

更新时间:2022-03-25 02:28:14

C++ 不是 C#.您不会通过添加引用"在 C++ 应用程序中包含 .dll.除非是 C++/CLI,但那不是 C++.

C++ is not C#. You don't include .dlls in C++ applications by adding "references". Unless it's C++/CLI, but that's not C++.

在 C++ 中,您将在项目配置中转到 Linker->Input->Additional Dependencies.在那里,您将列出库名称以及相关 .lib 的路径.

In C++, you would go, in the project configuration, to Linker->Input->Additional Dependencies. There, you would list the library name plus path to the .lib in question.

通常,当您构建 Windows C/C++ DLL 时,您还会获得一个 .lib.这是一个导入库;库的用户包括(如上所述)该 .lib 以便访问 DLL.他们通常不直接加载 .dll(尽管有办法做到这一点).

Normally, when you build a Windows C/C++ DLL, you also get a .lib. This is an import library; users of the library include (as stated above) that .lib in order to access the DLL. They generally do not load the .dll directly (though there are ways to do that).