c++ - .dll 与带有导出的 .dll,有什么区别?

标签 c++ windows visual-studio dll lib

在 Visual Studio 2019 上创建新项目显示以下内容:

  • 动态链接库 (DLL)
  • 带导出功能的动态链接库 (DLL)

在我之前,我们有静态库和动态库。

enter image description here

那么有什么区别呢?

我们在使用cmake时也有这种选项吗?

最佳答案

也许这有帮助:https://edwardhalferty.com/2020/08/29/difference-between-dynamic-link-library-with-exports-and-dynamic-link-library-in-visual-studio/

提取基本信息:

The major difference between them is, “with exports” adds some defines:

#define DLL1_API __declspec(dllexport)
#define DLL1_API __declspec(dllimport)

And it adds some example exports, so you can see how they work:

// This is an example of an exported variable
DLL1_API int nDll1=0;

// This is an example of an exported function.
DLL1_API int fnDll1(void)
{
    return 0;
}

// This is the constructor of a class that has been exported.
CDll1::CDll1()
{
    return;
}

In theory, you can compile this DLL and test it out immediately.

关于c++ - .dll 与带有导出的 .dll,有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71777507/

相关文章:

c++ - 将文本文件读入矩阵

c++ - 迭代器 - vector::iterator 和 array::iterator 的重载函数

C: 如何查看电脑是否被锁定/休眠?

visual-studio - 在 Visual Studio 中开发 MATLAB 代码

c++ - VS2012 : manifest authoring error c1010005: The root element name should be <assembly/>

java - 为什么int 1的最小值比正值更远离零?

windows - Lua io.popen() - 在 Windows 上访问共享驱动器

windows - 如果程序通过批处理脚本运行,如何启动 wav 文件

visual-studio - 为Visual Studio 2012解决方案中的每个项目配置全局输出bin/obj文件夹

c++ - MSVC __debugbreak()与openGL错误回调一起使用时不产生调用栈