visual-c++ - 从 DLL 导出函数 - 使用 DEF 文件或 dllexport?

标签 visual-c++

Module-definition (.def) files provide the linker with information about exports, attributes, and other information about the program to be linked. A .def file is most useful when building a DLL. Because there are linker options that can be used instead of module-definition statements, .def files are generally not necessary. You can also use __declspec(dllexport) as a way to specify exported functions.

http://msdn.microsoft.com/en-us/library/28d6s79h%28VS.80%29.aspx

我想知道,我们应该更喜欢.def 方式吗?或 dllexport 方式?

最佳答案

模块定义 (.def) 文件为我们提供了更大的灵 active 来定义数据的导出方式。

例如导出的函数可以是匿名的(用序号标识),防止没有声明信息的人使用。

它还可以 ddo 函数转发/重定向,如下所述:
http://msdn.microsoft.com/en-us/library/hyx1zcd3(v=VS.80).aspx

关于visual-c++ - 从 DLL 导出函数 - 使用 DEF 文件或 dllexport?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3314941/

相关文章:

c++ - Qt 中的 Win32 API

visual-c++ - Windows上的__block以便编译libdispatch

visual-c++ - 新显卡上的 nvoglv32.dll 中的绘制调用崩溃

c - Return 语句在 Visual Studio 2013 中需要额外的分号

从 vector<pair<double*,pair<double*,int*>> 到数组的 C++ 转换

c++ - Qt5 连接导致 Unhandled Exception 或 HEAP CORRUPTION

visual-c++ - 使用 ffmpeg 输出 RTSP 流

C++将dll文件从根目录移动到子文件夹

c++ - 如何使用 MFC 或 C++ 增加或减少系统时间?

c++ - 错误 "System.AccessViolationException"显示切割后的二叉树 Visual C++