.h
#pragma once
extern int g_i; /*声明,未分配内存*/
extern "C" int __cdecl fn1(int i, short j); /*extern "C" 即不进行名称粉碎*/
char __stdcall fn2(int i, short j, char c);
short __fastcall fn3(char c, int i, short j);
class A
{
public:
A() {}
~A(){}
int fn4(int i, short j, char c);
};
/************************************************************************/
/*
?.obj中存储名称粉碎信息
?fn2@@YGDHFD@Z
?fn3@@YIFDHF@Z
?fn4@A@@QAEHHFD@Z
?fn2 名称粉碎
@@YGDHFD 参数信息
@Z 返回值信息
@A 类成员函数则包含类信息
可用C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\undname.exe查看函数声明
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>undname -f ?fn2@@YGDHFD@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "-f"
is :- "-f"
Undecoration of :- "?fn2@@YGDHFD@Z"
is :- "char __stdcall fn2(int,short,char)"
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>undname -f ?fn3@@YIFDHF@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "-f"
is :- "-f"
Undecoration of :- "?fn3@@YIFDHF@Z"
is :- "short __fastcall fn3(char,int,short)"
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin>undname -f ?fn4@A@@QAEHHFD@Z
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "-f"
is :- "-f"
Undecoration of :- "?fn4@A@@QAEHHFD@Z"
is :- "public: int __thiscall A::fn4(int,short,char)"
*/
/************************************************************************/
.cpp
#include "stdafx.h"
#include "A.h"
int g_i = 0; /*定义,分配内存*/
int fn1(int i, short j)
{
return i;
}
char __stdcall fn2(int i, short j, char c)
{
return c;
}
short __fastcall fn3(char c, int i, short j)
{
return j;
}
int A::fn4(int i, short j, char c)
{
return i;
}