在实际代码中,我遇到了一些“非虚拟 thunk”函数:
; `non-virtual thunk to'QTextCodecPlugin::create(QString const&)
EXPORT _ZThn8_N16QTextCodecPlugin6createERK7QString
_ZThn8_N16QTextCodecPlugin6createERK7QString
SUB.W R0, R0, #8
B.W _ZN16QTextCodecPlugin6createERK7QString; QTextCodecPlugin::create(QString const&)
; End of function `non-virtual thunk to'QTextCodecPlugin::create(QString const&)
; `non-virtual thunk to'QTextCodecPlugin::~QTextCodecPlugin()
EXPORT _ZThn8_N16QTextCodecPluginD1Ev
_ZThn8_N16QTextCodecPluginD1Ev
SUB.W R0, R0, #8
B.W _ZN16QTextCodecPluginD2Ev; QTextCodecPlugin::~QTextCodecPlugin()
; End of function `non-virtual thunk to'QTextCodecPlugin::~QTextCodecPlugin()
(GCC、C++、Android NDK、Qt、Necessitas、ARM)
c++filt
说:
$ c++filt _ZThn8_N16QTextCodecPlugin6createERK7QString
non-virtual thunk to QTextCodecPlugin::create(QString const&)
$ c++filt _ZThn8_N16QTextCodecPluginD1Ev
non-virtual thunk to QTextCodecPlugin::~QTextCodecPlugin()
这些“非虚拟 thunk” 做什么以及为什么做什么?