C++ name mangling

1: ?0: 构造器,?1 析构器
2:     @@QAE: public __thiscall
    @@AAE: private __thiscall
    @@QBE: public __thiscall const 
3: 返回值和参数类型
    B:const
    D:char
    E:unsigned char
    F:short
    G:unsigned short
    H:int
    I:unsigned int
    J:long
    K:unsigned long
    M:float
    N:double
    _N:bool
    PA:指针(*,后面的代号表明指针类型,如果相同类型的指针连续出现,以0代替,一个0代表一次重复)
    PB:const指针
    AA:引用(&)
    AB:const引用
    U:类或结构体
    V:Interface(接口)
    W4:enum
    X:void
    Z: 结尾标记
    @: 空,无得意思,构造或析构使用,与?0, ?1配合
--------------------------------------------------------------------------------
实例:熟读唐诗三百首,不拍你不会做诗,自己体会吧,如果你愿意。
--------------------------------------------------------------------------------
?0CritSec@@QAE@XZ (public: __thiscall CritSec::CritSec(void))
?0Tick@@QAE@K@Z (public: __thiscall Tick::Tick(unsigned long))
?1CritSec@@QAE@XZ (public: __thiscall CritSec::~CritSec(void))
?0CFontSet@@QAE@XZ (public: __thiscall CFontSet::CFontSet(void))
?0Dx2DDraw@@QAE@XZ (public: __thiscall Dx2DDraw::Dx2DDraw(void))
?1AutoLock@@QAE@XZ (public: __thiscall AutoLock::~AutoLock(void))
?1CD3DDraw@@QAE@XZ (public: __thiscall CD3DDraw::~CD3DDraw(void))
?1CFontSet@@QAE@XZ (public: __thiscall CFontSet::~CFontSet(void))
?1Dx2DDraw@@QAE@XZ (public: __thiscall Dx2DDraw::~Dx2DDraw(void))
Lock@CritSec@@QAEXXZ (public: void __thiscall CritSec::Lock(void))
?0D3dDrawCmd@@QAE@XZ (public: __thiscall D3dDrawCmd::D3dDrawCmd(void))
?0ImgTexture@@QAE@XZ (public: __thiscall ImgTexture::ImgTexture(void))
Unlock@CritSec@@QAEXXZ (public: void __thiscall CritSec::Unlock(void))
?1ImgTexture@@QAE@XZ (public: __thiscall ImgTexture::~ImgTexture(void))
TryLock@CritSec@@QAEHXZ (public: int __thiscall CritSec::TryLock(void))
DelFont@CFontSet@@QAEHH@Z (public: int __thiscall CFontSet::DelFont(int))
TryLock@AutoLock@@QAEHXZ (public: int __thiscall AutoLock::TryLock(void))
Refresh@CD3DDraw@@QAEJXZ (public: long __thiscall CD3DDraw::Refresh(void))
?0ResImageList@@QAE@XZ (public: __thiscall ResImageList::ResImageList(void))
?0simplethread@@QAE@XZ (public: __thiscall simplethread::simplethread(void))
?BTick@@QBEKXZ (public: __thiscall Tick::operator unsigned long(void)const )
stop@simplethread@@QAEXXZ (public: void __thiscall simplethread::stop(void))
?1ResImageList@@QAE@XZ (public: __thiscall ResImageList::~ResImageList(void))
?1simplethread@@QAE@XZ (public: __thiscall simplethread::~simplethread(void))
pass@Tick@@QBE?AU1@XZ (public: struct Tick __thiscall Tick::pass(void)const )
?0CD3DDrawLayer@@QAE@XZ (public: __thiscall CD3DDrawLayer::CD3DDrawLayer(void))
?0D3dDrawCmdSet@@QAE@XZ (public: __thiscall D3dDrawCmdSet::D3dDrawCmdSet(void))
RenderAll@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::RenderAll(void))
Visible@CAllocator@@QAE_NXZ (public: bool __thiscall CAllocator::Visible(void))
?1D3dDrawCmdSet@@QAE@XZ (public: __thiscall D3dDrawCmdSet::~D3dDrawCmdSet(void))
ClearVideo@CD3DDraw@@QAEXXZ (public: void __thiscall CD3DDraw::ClearVideo(void))
TestDevice@CD3DDraw@@QAEJXZ (public: long __thiscall CD3DDraw::TestDevice(void))
clear@D3dDrawCmdSet@@QAEXXZ (public: void __thiscall D3dDrawCmdSet::clear(void))
EndPaint@CD3DDraw@@QAEJPAX@Z (public: long __thiscall CD3DDraw::EndPaint(void *))
getSize@ResImageList@@QAEHXZ (public: int __thiscall ResImageList::getSize(void))
CheckDevice@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::CheckDevice(void))
ClearDraw@CD3DDraw@@QAEJPAX@Z (public: long __thiscall CD3DDraw::ClearDraw(void *))
ResetDevice@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::ResetDevice(void))
SetD3DState@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::SetD3DState(void))
Visible@CD3DDrawLayer@@QAEHXZ (public: int __thiscall CD3DDrawLayer::Visible(void))
OnLostDevice@CFontSet@@QAEJXZ (public: long __thiscall CFontSet::OnLostDevice(void))
Popfront@ResImageList@@QAEXXZ (public: void __thiscall ResImageList::Popfront(void))
CreateDevice@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::CreateDevice(void))
OnLostDevice@CD3DDraw@@AAEXXZ (private: void __thiscall CD3DDraw::OnLostDevice(void))
RenderCursor@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::RenderCursor(void))
?1ImgTextureGeter@@QAE@XZ (public: __thiscall ImgTextureGeter::~ImgTextureGeter(void))
ClearCanvas@CD3DCanvas@@QAEJXZ (public: long __thiscall CD3DCanvas::ClearCanvas(void))
FontUninstall@CD3DDraw@@QAEXH@Z (public: void __thiscall CD3DDraw::FontUninstall(int))
OnResetDevice@CFontSet@@QAEJXZ (public: long __thiscall CFontSet::OnResetDevice(void))
ResetD3Device@CD3DDraw@@QAEJXZ (public: long __thiscall CD3DDraw::ResetD3Device(void))
OnResetDevice@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::OnResetDevice(void))
PresentCanvas@CD3DDraw@@AAEXXZ (private: void __thiscall CD3DDraw::PresentCanvas(void))
SetSysRatio@CD3DDraw@@QAEJHH@Z (public: long __thiscall CD3DDraw::SetSysRatio(int,int))
AddFont@CFontSet@@QAEHHHPAD@Z (public: int __thiscall CFontSet::AddFont(int,int,char *))
OnLostDevice@CAllocator@@QAEJXZ (public: long __thiscall CAllocator::OnLostDevice(void))
OnLostDevice@ImgTexture@@QAEJXZ (public: long __thiscall ImgTexture::OnLostDevice(void))
SetFullScreen@CD3DDraw@@QAEJ_N@Z (public: long __thiscall CD3DDraw::SetFullScreen(bool))
getFront@ResImageList@@QAEPADXZ (public: char * __thiscall ResImageList::getFront(void))
CleanSurface@CD3DDraw@@QAEJPAX@Z (public: long __thiscall CD3DDraw::CleanSurface(void *))
RecreateDevice@CD3DDraw@@AAEJXZ (private: long __thiscall CD3DDraw::RecreateDevice(void))
check_stop@simplethread@@QAE_NXZ (public: bool __thiscall simplethread::check_stop(void))
is_running@simplethread@@QAE_NXZ (public: bool __thiscall simplethread::is_running(void))
OnResetDevice@CAllocator@@QAEJXZ (public: long __thiscall CAllocator::OnResetDevice(void))
OnResetDevice@ImgTexture@@QAEJXZ (public: long __thiscall ImgTexture::OnResetDevice(void))
SetCursorEnable@CD3DDraw@@QAEXH@Z (public: void __thiscall CD3DDraw::SetCursorEnable(int))
DrawLineH@CD3DCanvas@@QAEJHHH@Z (public: long __thiscall CD3DCanvas::DrawLineH(int,int,int))
DrawLineV@CD3DCanvas@@QAEJHHH@Z (public: long __thiscall CD3DCanvas::DrawLineV(int,int,int))
get_canvasWidth@CD3DCanvas@@QAEHXZ (public: int __thiscall CD3DCanvas::get_canvasWidth(void))
AllocatorVisible@CD3DDraw@@AAE_NXZ (private: bool __thiscall CD3DDraw::AllocatorVisible(void))
BeginPaint@CD3DDraw@@QAEPAXK@Z (public: void * __thiscall CD3DDraw::BeginPaint(unsigned long))
TextWidth@CFontSet@@QAEJHPBD@Z (public: long __thiscall CFontSet::TextWidth(int,char const *))
count@D3dDrawCmdSet@@QBEIXZ (public: unsigned int __thiscall D3dDrawCmdSet::count(void)const )
get_arglist@simplethread@@QAEPAXXZ (public: void * __thiscall simplethread::get_arglist(void))
set_bColor@CD3DCanvas@@QAEXK@Z (public: void __thiscall CD3DCanvas::set_bColor(unsigned long))
set_fColor@CD3DCanvas@@QAEXK@Z (public: void __thiscall CD3DCanvas::set_fColor(unsigned long))
Pushback@ResImageList@@QAEXPBD@Z (public: void __thiscall ResImageList::Pushback(char const *))
get_canvasHeight@CD3DCanvas@@QAEHXZ (public: int __thiscall CD3DCanvas::get_canvasHeight(void))
?0CD3DDraw@@QAE@PAUHWND__@@AAJ@Z (public: __thiscall CD3DDraw::CD3DDraw(struct HWND__ *,long &))
SetVideoRenderMode@CD3DDraw@@QAEXH@Z (public: void __thiscall CD3DDraw::SetVideoRenderMode(int))
?0AutoLock@@QAE@PAVCritSec@@HH@Z (public: __thiscall AutoLock::AutoLock(class CritSec *,int,int))
FontInstall@CD3DDraw@@QAEXHHPAD@Z (public: void __thiscall CD3DDraw::FontInstall(int,int,char *))
DrawLineH@CD3DDraw@@QAEJPAXHHH@Z (public: long __thiscall CD3DDraw::DrawLineH(void *,int,int,int))
DrawLineV@CD3DDraw@@QAEJPAXHHH@Z (public: long __thiscall CD3DDraw::DrawLineV(void *,int,int,int))
GetItem@CFontSet@@QAEPAUDrawFont@@H@Z (public: struct DrawFont * __thiscall CFontSet::GetItem(int))
DrawRect@CD3DCanvas@@QAEJUtagRECT@@@Z (public: long __thiscall CD3DCanvas::DrawRect(struct tagRECT))
FillRect@CD3DCanvas@@QAEJUtagRECT@@@Z (public: long __thiscall CD3DCanvas::FillRect(struct tagRECT))
SetResolutionRatio@CD3DDraw@@QAEJHH@Z (public: long __thiscall CD3DDraw::SetResolutionRatio(int,int))
FontTextWidth@CD3DDraw@@QAEJHPBD@Z (public: long __thiscall CD3DDraw::FontTextWidth(int,char const *))
LoadResImage@CD3DDraw@@QAEJPAXPBD@Z (public: long __thiscall CD3DDraw::LoadResImage(void *,char const *))
DrawRect@CD3DDraw@@QAEJPAXUtagRECT@@@Z (public: long __thiscall CD3DDraw::DrawRect(void *,struct tagRECT))
FillRect@CD3DDraw@@QAEJPAXUtagRECT@@@Z (public: long __thiscall CD3DDraw::FillRect(void *,struct tagRECT))
OnLostDevice@CDoubleBufferCanvas@@QAEJXZ (public: long __thiscall CDoubleBufferCanvas::OnLostDevice(void))
SetClipRect@Dx2DDraw@@QAEXPAUtagRECT@@@Z (public: void __thiscall Dx2DDraw::SetClipRect(struct tagRECT *))
GetResolutionRatio@CD3DDraw@@QAEJPAH0@Z (public: long __thiscall CD3DDraw::GetResolutionRatio(int *,int *))
sync_to@D3dDrawCmdSet@@QAEXAAU1@@Z (public: void __thiscall D3dDrawCmdSet::sync_to(struct D3dDrawCmdSet &))
?8D3dDrawCmd@@QBE_NABU0@@Z (public: bool __thiscall D3dDrawCmd::operator==(struct D3dDrawCmd const &)const )
?9D3dDrawCmd@@QBE_NABU0@@Z (public: bool __thiscall D3dDrawCmd::operator!=(struct D3dDrawCmd const &)const )
OnResetDevice@CDoubleBufferCanvas@@QAEJXZ (public: long __thiscall CDoubleBufferCanvas::OnResetDevice(void))
SetVideoRect@CD3DDraw@@QAEXPAUtagRECT@@@Z (public: void __thiscall CD3DDraw::SetVideoRect(struct tagRECT *))
set_clipRect@CD3DCanvas@@QAEXUtagRECT@@@Z (public: void __thiscall CD3DCanvas::set_clipRect(struct tagRECT))
Render@CD3DDraw@@AAEJPAUCD3DDrawLayer@@@Z (private: long __thiscall CD3DDraw::Render(struct CD3DDrawLayer *))
--------------------------------------------------------------------------------
当函数使用__cdecl调用约定时,编译器进行以下工作:
 
1.以?标识函数名的开始,后跟函数名函数名后面以@@YA标识开始,后跟返回值和参数表;
5、当函数返回值为某个类或带有const性质的类的时候,返回值的命名为:?A/?B+V+类名+@@(不带加号)。
   当函数返回值为某个类的指针/引用或者带有const性质的类的指针/引用的时候,返回值的命名为:PA/AA或者PB/AB+V+类名+@@(不带加号);
6、函数参数为某个类的时候,并且该参数所使用的类曾经出现过的话(也就是与函数返回值所使用的类相同或者与前一个参数使用的类相同),
   则该参数类型格式为:V+1+@(不带加号)。如果该参数所使用的类没有出现过的话,则该参数类型格式为:V+类名+@@(不带加号)。函数参数为某个类的指针 /引用或者带有const性质指针/引用的时候,则该参数类型格式是在上述格式的基础上在V前面加上代表指针/引用类型或者带有const性质指针/引用类型的标识符(PA/AA或PB/AB);
7、参数表后以@Z标识整个名字的结束,如果该函数无参数,则以Z标识结束。
 
当函数使用__stdcall调用约定时,编译器所做工作的规则同上面的__cdecl调用约定,只是参数表的开始标识由上面的@@YA变为@@YG。
当函数使用__fastcall调用约定时,编译器所做工作的规则同上面的__cdecl调用约定,只是参数表的开始标识由上面的@@YA变为@@YI。

原文地址:https://www.cnblogs.com/maifengqiang/p/3129604.html