nativesockets doesn't compile for Android 4.x (API v19 or older) because of gethostbyaddr #4376

Closed
endragor opened this Issue Jun 20, 2016 · 1 comment

Projects

None yet

2 participants

@endragor
Contributor
endragor commented Jun 20, 2016 edited

Nim's posix module uses the correct POSIX signature for gethostbyaddr that accepts const void * as the first argument.

Up until API level 19 (Android 4.x), Android used a different signature that accepts const char * as the first argument, and int as the second (instead of socklen_t). This makes Nim networking code not compile for Android when targeting version 4.x or newer (the reasonable version to target as about 50% of Android devices today are 4.x).

Is there any clean way to resolve this? I'd note that newer versions of their API use POSIX-compliant signature, but it's only compatible with Android 5.0 or newer.

@dom96
Member
dom96 commented Jun 20, 2016

I guess the best way would be to add a ``android4_support` (or similar) define.

@endragor endragor added a commit to endragor/Nim that referenced this issue Jun 22, 2016
@endragor endragor Added 'android4' define support that declares a different gethostbyad…
…dr. Fixes #4376
45f7673
@Araq Araq closed this in #4419 Jun 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment