的P / Invoke的单Invoke

2023-09-04 22:47:00 作者:少发脾气,按时睡觉

什么是单的平台调用执行在Linux上的现状如何?而在Solaris上?

What's the current status of Mono's Platform Invoke implementation on Linux? And on Solaris?

推荐答案

工作,实用和稳定。它是很好的测试,因为相当多的单声道自己的低级别的功能必须通过它被编排到底层操作系统。

Working, usable and stable. It's well tested since quite a lot of mono's own low-level functionality has to be marshaled through it to the underlying operating system.

有一些的P / Invoke扩展程序相比,微软的.Net执行时(毕竟,他们与一个单一的操作系统家人和三种架构最多)。最显着的将是该库映射转换库名到特定OS的变种(如 mylib.dll 搜索 mylib.so 在Linux上, mylib.dylib 在OS X等),并考虑到各种其它系统特定的约定。还有一个 DLLMap 配置扩展,它可以使用,如果默认名称的翻译是不够的。通常它的方便的二进制lib中暴露在不同的操作系统中相同的API,使平台之间的迁移只需要改变C code,而不是净的部分。

There are some P/Invoke extensions when compared to Microsoft .Net implementation (after all they deal with a single OS family and three architectures at most). Most notable of those would be that library mappings transform the library name to OS-specific variants (e.g. mylib.dll searches for mylib.so on Linux, mylib.dylib on OS X and so on) and take into account various other system specific conventions. There is also a DLLMap configuration extension which can be used if the default name translations are not enough. Usually it's convenient to have the same API of the binary lib exposed on different OSes, so that migrating between platforms only requires changes in the C code, not the .Net part.