zeromq / clrzmq4

ZeroMQ C# namespace (.NET and mono, Windows, Linux and MacOSX, x86 and amd64)
GNU Lesser General Public License v3.0
241 stars 112 forks source link

Fix platform priority handling for "__Internal" #43

Closed gillima closed 8 years ago

gillima commented 8 years ago

The Internal implementation of class Platform is overwritten in SetupPlatformImplementation with Posix because platform name has higher priority. The platform Posix is needed for the ZPollItems implementation. Therefore I changed the priority in case of Internal.

metadings commented 8 years ago

Please, remove your changes to lib\Platform.cs, to just have changes in lib\Platform.cs, the new Win32Exception...

metadings commented 8 years ago

Please try my current changes using git pull zeromq master, building and compiling the project...

For example, I'm now redirecting libversion_delegate to libversion__Internal method and also Platform.LoadUnmanagedLibraryDelegate to Platform.__Internal.LoadUnmanagedLibrary.

This is now trying IsMonoTouch to have Kind == __Internal. I wonder what Platform.Kind you have on your iOS...? Does MonoTouch also run on Android?

gillima commented 8 years ago

MonoTouch is iOS only, MonoDroid is for Android. Xamarin has changed the namespaces some time ago. The iOS stuff is now located in 'Xamarin.iOS, the Android classes are inXamarin.Android`. You can take a look at https://developer.xamarin.com/api/ to get a overview.

Will inform you about Platform.Kind tomorrow.

gillima commented 8 years ago

On iPhone 5 with iOS9 i get the follwing: Platform: Unix, PEKinds: ILOnly, Architecture: I386 This is the output of the following code:

ImageFileMachine architecture;
PortableExecutableKinds peKinds;
typeof(object).Module.GetPEKind(out peKinds, out architecture);
Console.WriteLine("Platform: {0}, PortableExecutableKinds: {1}, Architecture: {2}", Environment.OSVersion.Platform, peKinds, architecture);
gillima commented 8 years ago

YEAH, I only fixed the iOS detection and clrzmq4 just created a dealer socket using curve encryption on our iPhone 6!!! Already did a PR for the detection stuff... Hope it' get's in. Many thanks for the great improvements!

metadings commented 8 years ago

YEAH... So you say iPhones are and Androids may be running ZeroMQ? That sounds nice... :)

gillima commented 8 years ago

Tested with iPhone5 and iPhone6, iOS8 and iOS9 using a dealer socket with curve encryption that connects to a linux router socket... So yes, this works fine. Android may run, but I can't test.

metadings commented 8 years ago

:+1:

metadings commented 8 years ago

I need to know what Platform.Kind and Platform.Name you get in the static Platform() constructor, just before SetupImplementation(typeof(Platform))...

It should be PlatformKind.__Internal but may also be PlatformKind.Posix... Do you have the output of the above Console.WriteLine and also something like

Console.WriteLine("Kind: {0}, Name: {1}", Platform.Kind, Platform.Name)

?

metadings commented 8 years ago

I want Platform.Kind to be PlatformKind.__Internal or PlatformKind.Posix, and Platform.Name to be PlatformName.Android or PlatformName.iOS and the like...