用. def创建DLL来定义函数名
Creating DLL with .DEF to Define function names
我试图创建一个DLL并定义函数名与.def文件,但它似乎不工作。我的DLL头文件是:
#ifdef ColorDLL_EXPORTS
#define ColorDLL_API
#endif
int ColorSelect(int i);
Cpp文件:
#include "stdafx.h"
#include "ColorDLL.h"
#using <ColorDiologeClass.dll>
int ColorSelect(int i){
ColorDiologeClass::Class1::ColorReturn(1);
return 1;
}
我在解决方案资源管理器中添加了一个ColorDLL.def,并添加了一个.DEF文件,该文件看起来像这样:
LIBRARY "ColorDLL"
EXPORTS
ColorSelect
当我使用Dumpbin/Exports时,结果是
name
ColorSelect = ?ColorSelect@@YAHH@Z (int __cdec1 ColorSelect(int))
我看到它的名字看起来像这样
name
ColorSelect
如何去掉=部分?
如果您使用__declspec(dllexport)
,则将发出修改后的名称,正如您所看到的那样。您根本不需要. def文件。删除第一个文件,对于不同的结果只使用def文件。
注意#if的两个分支都有导出
相关文章:
- 在命名空间中定义函数还是限定函数
- 为什么在定义函数之前先声明它
- 使用用户定义函数的字符串反转
- 用户定义函数中的指针和输入
- 这个c++代码是如何在没有定义函数的情况下运行的
- 具有外部"c"和程序集的未定义函数
- 已定义函数时出现 G++ "未定义的引用"错误
- 将自定义函数传递到基抽象类中以延迟执行
- C++使用 rand 定义函数语法
- Arduino:在 loop() 和自定义函数中运行相同的代码时出现问题
- 将具有固定签名的自定义函数名称注入 CRTP
- 使用定义函数模板别名
- 是否可以使用单个定义定义函数的常量和常规版本?(使用模板,自动,decltype等)
- 在内联程序集中定义函数和从 C++ 调用时出现问题
- 在 Metal 着色器代码中,如何定义函数的 in/out 参数变量?
- 声明和定义函数静态会产生"undefined reference to function_name()"
- 朋友定义函数的名称空间是什么
- 介子 对用户定义函数的未定义引用
- 如何使用 "using" 关键字定义函数原型/签名
- 在 C 结构中定义C++函数