How the CLR handles extern method calls in C #

I want to ask why all calls to the extern method are static? How does the CLR handle these calls?

+5
source share
2 answers

External method calls are unmanaged code. Thus, it makes no sense to call an instance of an object (managed) - the first (hidden) argument in the instance method is a reference to the instance, otherwise this. Typically, methods externinclude simply simple types (primitives, strings, etc.) - not objects (with the possible exception of arrays), and even they are often resolved first IntPtr).

+4
source

extern , , API- "C-style", C , static.

100% , ThisCall, [DllImport] ++.

+2

All Articles