Suppose I have an ILAsm library with the following code:
.assembly extern mscorlib{}
.assembly TestMe{}
.module TestMe.dll
.method public static void PrintMe() cil managed
{
ldstr "I'm alive!"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
How can I call a global PrintMe() function from a C# code?
You can't, as far as I'm aware. C# only "knows" about methods declared in types - not at the top level. Move your method into a type.
See more on this question at Stackoverflow