开发者

P/Invoke coarsening

I wonder whether .NET CLR supports P/Invoke coarsening.

For example if开发者_运维技巧 we have three subsequent P/Invoke calls that deal with blittable types:

Native.DrawPolygon(1.0f, 1.0);
Native.DrawPolygon(2.0f, 1.0);
Native.DrawPolygon(3.0f, 1.0);

then we could perform managed-to-unmanaged context switch for the whole block just once, instead of doing it pointlessly three times.


No, the framework doesn't do this. You would have to build your API to minimise the managed-to-unmanaged switches.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜