为什么Qt Creator创建的dll与普通dll不同(非托管)

时间:2019-04-28 16:31:29

标签: c++ qt dll

最近,我尝试使用Visual Studio中内置的dll。 经过艰苦的尝试,我成功地编译了它,并得到了一些dll和一些头文件。 但是,当我尝试在Qt Creator中使用该dll时,它总是告诉我“对'_imp___的未定义引用”

我必须怀疑我的dll是否正确编译。因此,我使用DLL Export Viewer来检查我的dll。

我的dll功能:

bool __cdecl MsgPack::registerPacker(int,signed char,class QByteArray (__cdecl*)(class QVariant const & __ptr64))   0x0000000180001280  0x00001280  50 (0x32)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
bool __cdecl MsgPack::registerType(enum QMetaType::Type,unsigned char)  0x0000000180001290  0x00001290  51 (0x33)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
bool __cdecl MsgPack::registerUnpacker(signed char,class QVariant (__cdecl*)(class QByteArray const & __ptr64)) 0x00000001800012a0  0x000012a0  52 (0x34)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
class MsgPackStream & __ptr64 __cdecl operator<<(class MsgPackStream & __ptr64,class QDate const & __ptr64) 0x00000001800078b0  0x000078b0  27 (0x1b)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
class MsgPackStream & __ptr64 __cdecl operator<<(class MsgPackStream & __ptr64,class QDateTime const & __ptr64) 0x00000001800079d0  0x000079d0  28 (0x1c)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
class MsgPackStream & __ptr64 __cdecl operator<<(class MsgPackStream & __ptr64,class QPoint const & __ptr64)    0x0000000180008150  0x00008150  29 (0x1d)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
class MsgPackStream & __ptr64 __cdecl operator<<(class MsgPackStream & __ptr64,class QRect const & __ptr64) 0x0000000180008260  0x00008260  30 (0x1e)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   
class MsgPackStream & __ptr64 __cdecl operator<<(class MsgPackStream & __ptr64,class QSize const & __ptr64) 0x00000001800083d0  0x000083d0  31 (0x1f)   qmsgpack.dll    C:\Users\Ivy\Desktop\Qt Project\Test\Test\qmsgpack.dll  Exported Function   

但是,由qt创建的dll(lib)可以很好地链接,看起来像这样

_ZN8Untitled4FOOkEv 0x6a9413d0  0x000013d0  1 (0x1) untitled.dll    C:\Users\Ivy\Desktop\Qt Project\build-untitled-Desktop_Qt_5_12_3_MinGW_64_bit-Release\release\untitled.dll  Exported Function   
_ZN8UntitledC1Ev    0x6a9413c0  0x000013c0  2 (0x2) untitled.dll    C:\Users\Ivy\Desktop\Qt Project\build-untitled-Desktop_Qt_5_12_3_MinGW_64_bit-Release\release\untitled.dll  Exported Function   
_ZN8UntitledC2Ev    0x6a9413c0  0x000013c0  3 (0x3) untitled.dll    C:\Users\Ivy\Desktop\Qt Project\build-untitled-Desktop_Qt_5_12_3_MinGW_64_bit-Release\release\untitled.dll  Exported Function   

也难怪当我尝试链接到普通dll时,它无法链接。

我检查了系统中的其他dll,但它们的函数名都没有以一些奇怪的下划线混合词开头。

有人可以解释吗?

0 个答案:

没有答案