Modification and name modification in DLL (3)

zhaozj2021-02-16  51

Modification and name modification in DLL (3)

2, C compile time function (non-class member function) name modification

When the function uses the __cdecl call convention, the compiler performs the following work:

1. Taking the beginning of the logo function name, then follow the function name;

2. The function name is started with the @@ ya identifier, and then returns the value and the parameter table;

3. When the return value of the function or the parameter is independent of the C class, the return value and the parameter table below:

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: Pointer (*, the subunies indicate the pointer type, if the same type of pointer continuously, 0

Instead, a 0 represents a repetition)

PB: Const pointer

AA: Quote (&)

AB: const referenced

U: class or structure

V: interface

W4: ENUM

X: void

4. After the @@ ya identification, it is followed by the return value type of the function. Thereafter, the data type of the parameter is subsequently, the pointer identifies before the data is used. When the return value or parameter of the function is independent of the C class, it is in line with this rule, otherwise it will be processed according to 5, 6 rules;

5. When the function return value is a class or a class with constant, the return value is named:? A /? B V class name @@ (without plus). When the function return value is a pointer / reference, or a pointer / reference with the CONST nature, the return value is named: PA / AA or PB / AB V Class @@ (without adding number);

6. When the function parameter is a class, and the class used by this parameter has appeared (which is the same as the class used by the returns value or the class used by the previous parameter), the parameter type format To: V 1 @ (without plus sign). If the class used by this parameter does not appear, the parameter type format is: V class name @@ (without plus sign). When the function parameter is a pointer / reference, or when there is a Const property pointer / reference, the parameter type format is based on the above format, plus a representative pointer / reference type or a Const property pointer / Reference type identifier (PA / AA or PB / AB);

7. After the parameter table is identified with the end of the entire name, if the function does not have parameters, the z identity ends.

When a function is using the __stdcall call convention, the rule of the compiler works with the above __cdecl calls, but the start identification of the parameter table is changed from the @@ ya to @@ YG.

When the function is using the __fastcall call convention, the rules of the compiler work together with the above __cdecl call, just the start identification of the parameter table is changed from the @@ ya to @@ yi. 3, C compile class and its member function name modification

For exported C classes, only the __cdecl call convention can be used. During the compiler compile, the compiler will process the C class. Such as: class __declspec (dllexport) MyClass is processed as class myclass & myclass :: operator = (Class Myclass Const &). When the C compiler is modified to the C class, the compiler performs the following work:

1. Taking the beginning of the logo function name, followed by? 4 class name;

2. The class name is followed by @@ QAE identifies, which is fixed for the export class;

3. @@ qe behind the AAV0 @ abv0 @, ie reference type identifier AA V 0 (Identifier of repetitive classes) @ (without plus sign) and CONST nature reference AB V 0 (repetitive class) Identifier) ​​ @ (without plus sign);

4. Finally, with the @z identify the end of the entire name.

For members of the C class (non-configuration functions, and destructor), different calls can be used. When the member function in the exported C class uses the __cdecl call convention, the compiler performs the following work:

1. Taking the beginning of the logo function name, then follow the function name @ class name (without plus sign);

2. After the @@ QAE identification start, follow the return value and parameter table;

3. When the return value of the function or the parameter is independent of the C class, the return value and the parameter table below:

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: Pointer (*, the subunies indicate the pointer type, if the same type of pointer continuously, 0

Instead, a 0 represents a repetition)

PB: Const pointer

AA: Quote (&)

AB: const referenced

U: class or structure

V: interface

W4: ENUM

X: void

4, the @@ QAE identification followed by the return value type of the function, and then the data type of the parameter is subsequently, the pointer identifies before the specified data type. When the return value or parameter of the function is independent of the C class, it is in line with this rule, otherwise it will be processed according to 5, 6 rules;

5. When the function return value is the current class or the current class with const, the return value is named:? A or? B v 1 @@ (without plus sign). When the function returns the value of the current class / reference, or when the current class with the const nature, the return value is named: PA / AA or PB / AB V 1 @@ (without adding No.); 6, when the function returns a certain class or a class with constant nature, the return value is named:? A /? B V Class name @@ (without plus sign). When the function return value is a pointer / reference, or a pointer / reference with the CONST nature, the return value is named: PA / AA or PB / AB V Class @@ (without adding number);

7. When the function parameter is a class, and the class used by this parameter has appeared (that is, the class currently exported, the same as the class used by the function return value or the same class as the previous parameter) Class), the parameter type format is: V 1 @ (without plus sign). If the class used by this parameter is not the class currently exported, the parameter type format is: V class name @@ (without plus). When the function parameter is a pointer / reference, or when there is a Const property pointer / reference, the parameter type format is based on the above format, plus a representative pointer / reference type or a Const property pointer / Reference type identifier (PA / AA or PB / AB);

8. After the parameter table identifies the end of the entire name, if the function is not parameters, the z identity ends.

When a function is using the __stdcall call convention, the rule of the compiler works with the above __cdecl calls, but the start identification of the parameter table is changed from the @@ ya to @@ YG.

When the function is using the __fastcall call convention, the rules of the compiler work together with the above __cdecl call, just the start identification of the parameter table is changed from the @@ ya to @@ yi.

4, C compilation to export data, name modification

For exported data, only the __cdecl call convention is used. When the C compiler is modified to the C class, the compiler performs the following work:

1. Taking the beginning of the data, then follow the data name;

2. The data name begins with the @@ 3 identifier, followed by the data type;

3. When the data type is independent of the C class, the data type The following code indicates:

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: Pointer (*, the subunies indicate the pointer type, if the same type of pointer continuously, 0

Instead, a 0 represents a repetition)

PB: Const pointer

AA: Reference (&) AB: Const reference

U: class or structure

V: interface

W4: ENUM

X: void

4. If the data type is a class, the data type is named: V class name @@ (without plus sign). When the data type is a pointer / reference, or a pointer / reference with a CONST nature, the data type is named: PA / AA or PB / AB V Class @@ (without plus sign );

5. Finally, if the data type is constant, the modulation name is ended in B. If the data type is non-const nature, the modulation name is ended with A.

Continued: DLL calls and name modification (1)

DLL calls the agreement and name modification (2)

============================================================================================================================================================================================================= ==============

The place where the powder color is inaccurate, and there is still a lot of things about the name modification, but it is basically used in the DLL, so it has not been analyzed.

--- Rivershan Original in 2004.3.3 5:32

转载请注明原文地址:https://www.9cbs.com/read-26673.html

New Post(0)