📄 callback.il
字号:
// Necessary preliminaries
.assembly extern mscorlib {}
.assembly callback { }
.module callback.exe
// Here is the unsorted data we want to sort. With minor improvements,
// I could make the data to be received from a file or the console,
// but it would not serve any illustrative purpose.
// Feel free to try modifying the code in this aspect.
.class private value explicit sealed SixtyBytes { .pack 1 .size 60 }
.field public static valuetype SixtyBytes DataToSort at D_0001
.data D_0001 = {int32(10), int32(32), int32(-1), int32(567),
int32(3), int32(18), int32(1), int32(-51), int32(789), int32(2345),
int32(-43), int32(788), int32(-345), int32(345), int32(0)}
// To show that the sorting really happens, I am going to print
// out data before and after the sorting. Rather than using the
// [mscorlib]System.Console::WriteLine, I will P/Invoke the C
// function int printf(char* Format,...)
.method public hidebysig static pinvokeimpl("msvcrt.dll" ansi cdecl)
vararg int32 printf(string) cil managed preservesig {}
// And this is a managed printing method, invoking the printf.
.method public static void printInt32(void* pBuff, int32 N)
{
.locals init(int32 i, void* pb)
// i = 1;
ldc.i4.1
stloc.0
// pb = pBuff;
ldarg.0
stloc.1
Next: // if(i > N) goto Return;
ldloc.0
ldarg.1
bgt Return
// printf(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -