为什么我在VS2022中使用.DEF文件转发DLL函数失败?

问题描述 投票:0回答:1

我希望我的 DLL 导出一个函数转发到同名的其他模块函数。

例如:

#pragma comment(linker, "/export:func=module.func,@100")

效果很好。

但是如果我改用.DEF文件,链接器报错:LNK2001, unresolved external symbol func

EXPORTS
    func = module.func @100

这两种方式不是等价的吗,问题出在哪里?

链接器不应该找出“func”符号。 期望将“func”转发到模块的“func”条目。

c++ windows visual-studio dll
1个回答
0
投票

如果

module
是你的dll的名字,那么使用

EXPORTS
    func @100

出口

如果您导出的名称来自其他模块,请指定 使用 other_module.exported_name.

在 DLL 中导出名称
EXPORTS
   func2=other_module.func1
© www.soinside.com 2019 - 2024. All rights reserved.