What is [DllImport(“QCall”)]?

后端 未结 3 492
面向向阳花
面向向阳花 2020-12-04 17:26

Many methods in the .Net library are implemented in native code. Those that come from the framework itself are marked with [MethodImpl(MethodImplOptions.InternalCall)]

3条回答
  •  一个人的身影
    2020-12-04 18:14

    I asked some people in the .Net team about this.

    QCalls are calls to native methods within the CLR runtime. They behave like other [DllImport]s, but they're faster because they make specific (undocumented) assumptions about what the native methods do, so they can skip various marshalling and GC and exception checks.

    InternalCall is different; it's for calls for special reflection-style things which are generated at runtime (this wasn't very clear).

提交回复
热议问题