[Mono-dev] Mono.Posix Cross Compiling

Greg Young gregoryyoung1 at gmail.com
Wed Jan 7 14:52:23 UTC 2015

Sorry the question was already answered above but let me restate the issue.

The issue is compiling between ms build and xbuild as the mono.posix
reference should only be there in Unix (windows uses win api calls)

Above is a good solution (conditional reference) which works. I know we
could manually add a binary reference to mono.posix.dll and then not use it
but that just feels wrong. The conditional reference is exactly what we
were looking for and works like a charm now!

The alternative we were looking at was copy/pasting syscalls.cs which is
also ugly :)


On Wednesday, January 7, 2015, Jonathan Pryor <jonpryor at vt.edu> wrote:

> On Jan 5, 2015, at 6:08 PM, Greg Young <gregoryyoung1 at gmail.com
> <javascript:;>> wrote:
> > Have anyone used mono.posix or mono.unix.native in a cross compiling
> scenario where you have to support visual studio builds? How did you handle
> this? I don't seem to be able to do a platform specific reference.
> What's the problem? Mono.Posix.dll is MIT/X11; simply bundle the assembly
> with your code, along with MonoPosixHelper.dll (just copy from the Mono
> install).
> Furthermore, Mono.Unix.Native.Stdlib should work as-is on Windows (it uses
> MSVCRT.dll).
> You will need to be careful not to actually use Syscall/etc. on Windows,
> but due to the lazy nature of the JIT this should be reasonably
> straightforward:
>         if (running on Unix)
>                 MethodWhichUsesSyscall ();
>         ...
> MethodWhichUsesSyscall() won't be JIT'd unless executed, so any references
> to e.g. Syscall will be lazily evaluated, allowing things to work on
> Windows.
>  - Jon

Studying for the Turing test
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150107/cf9a4098/attachment.html>

More information about the Mono-devel-list mailing list