Skip to content

Commit 7472134

Browse files
author
Jarret Shook
committed
Use explicit calling convention for coredistools
coreclr is built with /Gz (stdcall), explicitly use __cdecl calling convention for calling functions in coredistools
1 parent 2507807 commit 7472134

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/inc/coredistools.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct CorAsmDiff;
4343

4444
// The custom print functionality to be provide by the
4545
// users of this Library
46-
typedef void(*Printer)(const char *msg, ...);
46+
typedef void(__cdecl *Printer)(const char *msg, ...);
4747
struct PrintControl {
4848
const Printer Error;
4949
const Printer Warning;
@@ -58,7 +58,7 @@ struct PrintControl {
5858
// and Offset2) from the beginning of their respective code blocks.
5959
// InstructionLength is the length of the current instruction being
6060
// compared for equivalency.
61-
typedef bool(*OffsetComparator)(const void *UserData, size_t BlockOffset,
61+
typedef bool(__cdecl *OffsetComparator)(const void *UserData, size_t BlockOffset,
6262
size_t InstructionLength, uint64_t Offset1,
6363
uint64_t Offset2);
6464

@@ -67,16 +67,16 @@ typedef bool(*OffsetComparator)(const void *UserData, size_t BlockOffset,
6767
// the importer.
6868

6969
// Initialize the disassembler, using default print controls
70-
typedef CorDisasm *InitDisasm_t(enum TargetArch Target);
70+
typedef CorDisasm * __cdecl InitDisasm_t(enum TargetArch Target);
7171
DllIface InitDisasm_t InitDisasm;
7272

7373
// Initialize the disassembler using custom print controls
74-
typedef CorDisasm *NewDisasm_t(enum TargetArch Target,
74+
typedef CorDisasm * __cdecl NewDisasm_t(enum TargetArch Target,
7575
const PrintControl *PControl);
7676
DllIface NewDisasm_t NewDisasm;
7777

7878
// Delete the disassembler
79-
typedef void FinishDisasm_t(const CorDisasm *Disasm);
79+
typedef void __cdecl FinishDisasm_t(const CorDisasm *Disasm);
8080
DllIface FinishDisasm_t FinishDisasm;
8181

8282
// DisasmInstruction -- Disassemble one instruction
@@ -89,19 +89,19 @@ DllIface FinishDisasm_t FinishDisasm;
8989
// Returns:
9090
// -- The Size of the disassembled instruction
9191
// -- Zero on failure
92-
typedef size_t DisasmInstruction_t(const CorDisasm *Disasm,
92+
typedef size_t __cdecl DisasmInstruction_t(const CorDisasm *Disasm,
9393
const uint8_t *Address,
9494
const uint8_t *Bytes, size_t Maxlength);
9595
DllIface DisasmInstruction_t DisasmInstruction;
9696

9797
// Initialize the Code Differ
98-
typedef CorAsmDiff *NewDiffer_t(enum TargetArch Target,
98+
typedef CorAsmDiff * __cdecl NewDiffer_t(enum TargetArch Target,
9999
const PrintControl *PControl,
100100
const OffsetComparator Comparator);
101101
DllIface NewDiffer_t NewDiffer;
102102

103103
// Delete the Code Differ
104-
typedef void FinishDiff_t(const CorAsmDiff *AsmDiff);
104+
typedef void __cdecl FinishDiff_t(const CorAsmDiff *AsmDiff);
105105
DllIface FinishDiff_t FinishDiff;
106106

107107
// NearDiffCodeBlocks -- Compare two code blocks for semantic
@@ -118,7 +118,7 @@ DllIface FinishDiff_t FinishDiff;
118118
// Size2 -- The size of the second block
119119
// Returns:
120120
// -- true if the two blocks are equivalent, false if not.
121-
typedef bool NearDiffCodeBlocks_t(const CorAsmDiff *AsmDiff,
121+
typedef bool __cdecl NearDiffCodeBlocks_t(const CorAsmDiff *AsmDiff,
122122
const void *UserData,
123123
const uint8_t *Address1,
124124
const uint8_t *Bytes1, size_t Size1,
@@ -127,13 +127,13 @@ typedef bool NearDiffCodeBlocks_t(const CorAsmDiff *AsmDiff,
127127
DllIface NearDiffCodeBlocks_t NearDiffCodeBlocks;
128128

129129
// Print a code block according to the Disassembler's Print Controls
130-
typedef void DumpCodeBlock_t(const CorDisasm *Disasm, const uint8_t *Address,
130+
typedef void __cdecl DumpCodeBlock_t(const CorDisasm *Disasm, const uint8_t *Address,
131131
const uint8_t *Bytes, size_t Size);
132132
DllIface DumpCodeBlock_t DumpCodeBlock;
133133

134134
// Print the two code blocks being diffed, according to
135135
// AsmDiff's PrintControls.
136-
typedef void DumpDiffBlocks_t(const CorAsmDiff *AsmDiff,
136+
typedef void __cdecl DumpDiffBlocks_t(const CorAsmDiff *AsmDiff,
137137
const uint8_t *Address1, const uint8_t *Bytes1,
138138
size_t Size1, const uint8_t *Address2,
139139
const uint8_t *Bytes2, size_t Size2);

0 commit comments

Comments
 (0)