gpt4 book ai didi

c++ - 解密损坏的 C++ 名称 $$F

转载 作者:行者123 更新时间:2023-11-30 02:19:55 26 4
gpt4 key购买 nike

我的非托管 C++ 类中有以下函数调用:

_pUserApi = CThostFtdcMdApi::CreateFtdcMdApi();

编译器似乎生成了这个符号:

?CreateFtdcMdApi@CThostFtdcMdApi@@$$FSAPEAV1@PEBD_N1@Z

但是当我对我正在链接的 .lib 文件执行转储时,我看到了这个符号:

?CreateFtdcMdApi@CThostFtdcMdApi@@SAPEAV1@PEBD_N1@Z

区别在于第一个里面有一个额外的$$F。

是否有编译器选项可以解释这种差异?...是否有任何类型的引用资料来破译该改编?

注意:这是一个 x64 lib 文件(我正在使用选择的 x64 进行编译。

完整错误:

Error   LNK2028 unresolved token (0A000021) 
"public: static class CThostFtdcMdApi * __cdecl CThostFtdcMdApi::CreateFtdcMdApi(char const *,bool,bool)"
(?CreateFtdcMdApi@CThostFtdcMdApi@@$$FSAPEAV1@PEBD_N1@Z)
referenced in function "public: void __cdecl CTPMarketData::Start(char const *,char const *,char const *,char const *)"
(?Start@CTPMarketData@@$$FQEAAXPEBD000@Z)
CTPLib_cpp

完整的 DumpBin:

  61C __IMPORT_DESCRIPTOR_thostmduserapi
862 __NULL_IMPORT_DESCRIPTOR
9A0 thostmduserapi_NULL_THUNK_DATA
D94 ?CreateFtdcMdApi@CThostFtdcMdApi@@SAPEAV1@PEBD_N1@Z
D94 __imp_?CreateFtdcMdApi@CThostFtdcMdApi@@SAPEAV1@PEBD_N1@Z
E2C ?GetApiVersion@CThostFtdcMdApi@@SAPEBDXZ
E2C __imp_?GetApiVersion@CThostFtdcMdApi@@SAPEBDXZ
C0E ??1CThostFtdcMdApi@@IEAA@XZ
C0E __imp_??1CThostFtdcMdApi@@IEAA@XZ
B8E ??0CThostFtdcMdApi@@QEAA@XZ
B8E __imp_??0CThostFtdcMdApi@@QEAA@XZ
B08 ??0CThostFtdcMdApi@@QEAA@AEBV0@@Z
B08 __imp_??0CThostFtdcMdApi@@QEAA@AEBV0@@Z
C8E ??4CThostFtdcMdApi@@QEAAAEAV0@AEBV0@@Z
C8E __imp_??4CThostFtdcMdApi@@QEAAAEAV0@AEBV0@@Z
D18 __imp_??_7CThostFtdcMdApi@@6B@

visual studio生成的命令行:

d:\Program Files(x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\CL.exe/c/AI"C:\Program Files ( x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\"/AI"C:\Program Files (x86)\Windows Kits\10\References"/AI"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\Facades\"/Zi/clr/nologo/W3/WX -/diagnostics:classic/Od/Oy -/D WIN32/D _DEBUG/D _WINDLL/D _UNICODE/D UNICODE/EHa/MDd/GS/fp : precise/Zc : wchar_t/Zc : forScope/Zc : inline/Yu"stdafx.h"/Fp"Debug\CTPLib_cpp.pch"/Fo"Debug\"/Fd"Debug\vc141. pdb"/TP/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\mscorlib.dll"/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\System.Data.dll"/FU"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\System.dll"/FU"C:\Program文件 (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.6.1\System.Xml.dll"/analyze -/FC/errorReport : prompt/clr : nostdlib AssemblyInfo.cpp CTPMarketData.cpp CTPMarketDataWrapper.cpp CTPSpi.cpp

最佳答案

Microsoft 编译器带有一个 undname 实用程序:

用$$F:

C:\>undname ?CreateFtdcMdApi@CThostFtdcMdApi@@$$FSAPEAV1@PEBD_N1@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?CreateFtdcMdApi@CThostFtdcMdApi@@$$FSAPEAV1@PEBD_N1@Z"
is :- "public: static class CThostFtdcMdApi * __ptr64 __cdecl CThostFtdcMdApi::CreateFtdcMdApi(char const * __ptr64,bool,bool)"

没有:

c:\>undname ?CreateFtdcMdApi@CThostFtdcMdApi@@SAPEAV1@PEBD_N1@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.

Undecoration of :- "?CreateFtdcMdApi@CThostFtdcMdApi@@SAPEAV1@PEBD_N1@Z"
is :- "public: static class CThostFtdcMdApi * __ptr64 __cdecl CThostFtdcMdApi::CreateFtdcMdApi(char const * __ptr64,bool,bool)"

不幸的是,undname 将两者解码为相同的函数签名。需要进行更多挖掘......

PS:GCC 的等效工具是 c++filt

关于c++ - 解密损坏的 C++ 名称 $$F,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50265309/

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