0

我正在尝试在我的 Visual C++ (2015, OS - Windows8x64) MFC Win32 项目中使用一些 lib 和 dll。这个库是旧的,从 2005 年开始。在我的项目中,我在一些 dll 的函数调用中收到未解决的外部符号错误。所以我在引用的 dll 上做了一个小垃圾箱,结果发现 mangle 名称不匹配。例如这些功能。在 *.h 文件中:

1.

class AFX_EXT_CLASS CDcmPatientModule : public CDcmModule
{
public:
    DECLARE_SERIAL( CDcmPatientModule );
public:
    CString& PatientName();
......
}

2.

class  AFX_EXT_CLASS CDcmIOD : public CObject
{
    friend CDcmModule;
public:
    DECLARE_SERIAL( CDcmIOD );
    void Export( const CString& pathname );
    .....
};

1.项目中的mangle名称

?PatientName@CDcmPatientModule@@QAEAAV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@XZ

dll中的mangle名称

?PatientName@CDcmPatientIdentificationModule@@QAEAAVCString@@XZ

项目中的 demangle 名称(undname 命令)是:

public: class ATL:CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT > > & __thiscall CDcmPatientIdentificatioModule::PatientName(void)

dll 中的 demangle 名称为:

public: class CString & __thiscall CDcmPatientIdentificatioModule::PatientName(void)

2.项目中的mangle名称

?Export@CDcmIOD@@QAEXABV?$CStringT@DV?$StrTraitMFC@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@@Z

dll中的mangle名称

?Export@CDcmAttributeSet@@QAEXABVCString@@@Z

项目中的 demangle 名称

public void __thiscall CDcmIOD::Export(class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char>>>const &)

和 DLL 中的 demangle 名称

public: void __thiscall CDcmAttributeSet::Export(class CString const &)

如您所见,区别在于“CString”如何使这些名称匹配?

添加了#define USE_ADS_SHARED_LIB - 没有任何改变 在函数声明中添加__stdcall 也没有帮助。

4

0 回答 0