在 Visual Studio 2019 上创建新项目显示以下内容:
- 动态链接库 (DLL)
- 带导出功能的动态链接库 (DLL)
在我之前,我们有静态库和动态库。
那么有什么区别呢?
我们在使用cmake时也有这种选项吗?
最佳答案
提取基本信息:
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/