gpt4 book ai didi

c++ - 为什么导出的 dll 函数末尾有 @number 符号

转载 作者:行者123 更新时间:2023-11-30 04:53:13 25 4
gpt4 key购买 nike

我有一个包含超过 400 个函数的 dll,而我的 exe 文件只使用了 dll 中的 15 个函数,所以我需要创建一个新的 dll 并导出函数并伪造它们的返回值以模拟一个输出更复杂的系统。

我尝试过的:

 #include "stdafx.h"

//the compiler complains about the '@20'

__declspec ( dllexport ) XLStatus _xlActivateChannel@20(XLportHandle, XLuint64, unsigned int, unsigned int)
{
return 0;
}

// causing the exe to crash

dumpbin/exports vxlapi.dll(原始dll):显示重复的函数名称(并非所有函数)

ordinal  name
_xlActivateChannel@20
14 xlActivateChannel

注意:在dll的头文件中,函数声明如下:

DECL_STDXL_FUNC ( xlActivateChannel, XLACTIVATECHANNEL, (
XLportHandle portHandle,
XLaccess accessMask,
unsigned int busType,
unsigned int flags)
);

在转储/导出 dll为什么函数名称以“_”下划线开头并以“@number”结尾,注意:exe 使用的是假设(装饰)函数,我如何创建一个新的 dll 并导出包含@,

最佳答案

"@n" is used by the stdcall调用约定。你不需要在你的声明中提及它,你只需要将你的声明更改为 stdcall 以便编译器知道它们需要用“@n”后缀修饰。像这样:

__declspec ( dllexport ) XLStatus __stdcall _xlActivateChannel(XLportHandle,  XLuint64, unsigned int, unsigned int)

关于c++ - 为什么导出的 dll 函数末尾有 @number 符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53919640/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com