[Mono-dev] Mono.Posix Cross Compiling

Jonathan Pryor jonpryor at vt.edu
Wed Jan 7 14:33:02 UTC 2015


On Jan 5, 2015, at 6:08 PM, Greg Young <gregoryyoung1 at gmail.com> 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



More information about the Mono-devel-list mailing list