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

Chris Swiedler cswiedler at trionworlds.com
Wed Mar 30 16:06:40 UTC 2016

To Alan's point, we did see crashes when we (unintentionally) deployed Mono.Posix.dll along with our app. Our solution was, like he said, to Not Do That, and use our Mono.Posix as a compile-time library only.

I do think it's much easier to do it this way than to have different compile targets, which (if I'm understanding correctly) is what the other suggestions all require.


-----Original Message-----
From: mono-devel-list-bounces at lists.ximian.com [mailto:mono-devel-list-bounces at lists.ximian.com] On Behalf Of Jonathan Pryor
Sent: Wednesday, March 30, 2016 7:04 AM
To: Alan McGovern <alan.mcgovern at gmail.com>
Cc: mono-devel-list <mono-devel-list at lists.ximian.com>
Subject: Re: [Mono-dev] Cross Platform on Linux/Windows with Mono.Posix reference on Linux

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

Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com

More information about the Mono-devel-list mailing list