[Mono-dev] Cross Platform on Linux/Windows with Mono.Posix reference on Linux

Jonathan Pryor jonpryor at vt.edu
Wed Mar 30 14:04:04 UTC 2016

On Mar 30, 2016, at 8:33 AM, Alan <alan.mcgovern at gmail.com> wrote:
> If you package Mono.Posix.dll your app *will crash* on different systems.

Not necessarily.

> This binary is platform specific and is not safe to copy between OS’s.

Mono.Posix.dll *itself* contains no platform-specific code and is perfectly safe to copy between operating systems.

Mono.Posix.dll contains P/Invokes into “MonoPosixHelper” (libMonoPosixHelper.dylib on OS X, MonoPosixHelper.dll on Windows, etc.), and MonoPosixHelper contains operating system-specific code. It *cannot* be copied between operating systems; it’s a native library.

> It's fine to have a copy of Mono.Posix.dll used purely for compilation purposes. But at runtime you have to use the system provided one, which typically means the one provided by the system's mono installation.

It’s entirely fine to include Mono.Posix.dll with your app, SO LONG AS you *also* copy and distribute MonoPosixHelper with your app.

Additionally, Mono.Posix.dll also P/Invokes other native libraries such as INTL.DLL (Mono.Unix.Catalog) and MSVCRT.DLL (Mono.Unix.Native.Stdlib), which should be usable on Windows (so long as you also distribute INTL.DLL, etc.).

 - Jon

More information about the Mono-devel-list mailing list