Closed nicolasjinchereau closed 9 years ago
@aBothe Merge?
I was just too lazy to make further checks - I fear that one needs to externalize Mono.Posix-calls
I'm not sure what you mean by "externalize".
I tested this on Mac OSX and Windows. Both worked as expected.
Finally, this will stop the posix functions from being called on windows:
if(Environment.OSVersion.Platform != PlatformID.Unix)
return false;
Well okay, I just thought that .Net/Mono will load Mono.Posix as soon as it tries to execute the getter function for the first time - and then throws some TypeNotFound-Error because it can't locate some OS-agnostic DLL or so..but okay.. :D
Ok thanks =)
Just for reference, the call to uname
or any unix functions will be called using Pinvoke:
http://www.mono-project.com/docs/advanced/pinvoke/
Inside the DLL, there will be something like this:
[DllImport("libc.so")]
private static extern int uname(UTSName *buf);
If you try to call uname
on Windows, you will get a DllNotFoundException
, but the runtime will not attempt to look up uname
if you don't call it.
That's what I meant - but yeah, good to have the Unix-Platform-check :)
Sorry, just a reminder to add the DLL mentioned in the first comment ;)
Warning: putting out Mono-D without the Posix dll will break the windows build!
Sorry for my laziness, I've released a new version depending on Mono.Posix as well :)
My build is broken on windows :/ any idea where I can find this DLL ?
Alex just added it to the Mono-D repo: https://github.com/aBothe/Mono-D/tree/master/ext
Well.. no, I'm not gonna distribute an entire dll just for executing 'uname' - I'll let mono-d execute 'uname' as a system command, not as a Posix-something API call.
I don't understand.. You've already included it in the /ext folder and referenced it. When you build with Xamarin Studio, it will be copied to the output folder automatically, and when you run .../mdtool setup pack, it will automatically be packaged in.
Unless you've deleted it purposely, which would be pointless, because it's only 195kb.
@bitwise-github no, I had to reference the dll explicitly in the addin manifesto - I'm gonna execute uname
now.
eek! You're right. Sorry bout that. I must have accidentally copied it while debugging. Thanks for the fix ;)
No problem :) - I hope @etcimon can build and run Mono-D again now :D
Hmm i dont have the build Platform setup on my VMware instance can you update the repo?
I've uploaded a new version (2.13.3), if you mean that.
reference to Mono.Posix.dll must be added to the project. The file must be copied to the Mono-D distribution (./ext/Mono.Posix.dll), because it is not present on the Windows distribution of Xamarin Studio. Mono.Posix.dll can be found here: /Applications/Xamarin Studio.app/Contents/Resources/lib/monodevelop/AddIns/Xamarin.Sketches/XamarinInteractiveAgentsMac.app/Contents/MonoBundle/Mono.Posix.dll
The initial check for Unix will prevent the posix code from trying to run on windows.