Include JNIEXPORT on exported symbols

Motivation:
As noticed in https://stackoverflow.com/questions/45700277/
compilation can fail if the definition of a method doesn't
match the declaration.  It's easy enough to add this in, and make
it easy to compile.

Modifications:
Add JNIEXPORT to the entry points.

* On Windows this adds: `__declspec(dllexport)`
* On Mac this adds: `__attribute__((visibility("default")))`
* On Linux (GCC 4.2+) this adds: ` __attribute__((visibility("default")))`
* On other it doesn't add anything.

Result:
Easier compilation
This commit is contained in:
Carl Mastrangelo 2017-08-18 12:58:35 -07:00
parent fe2dd973e9
commit 7f1051b6ca
2 changed files with 4 additions and 4 deletions

View File

@ -624,7 +624,7 @@ jint JNI_OnLoad_netty_transport_native_epoll(JavaVM* vm, void* reserved) {
} }
#ifndef NETTY_BUILD_STATIC #ifndef NETTY_BUILD_STATIC
jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
return JNI_OnLoad_netty_transport_native_epoll(vm, reserved); return JNI_OnLoad_netty_transport_native_epoll(vm, reserved);
} }
#endif /* NETTY_BUILD_STATIC */ #endif /* NETTY_BUILD_STATIC */
@ -640,7 +640,7 @@ void JNI_OnUnload_netty_transport_native_epoll(JavaVM* vm, void* reserved) {
} }
#ifndef NETTY_BUILD_STATIC #ifndef NETTY_BUILD_STATIC
void JNI_OnUnload(JavaVM* vm, void* reserved) { JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved) {
JNI_OnUnload_netty_transport_native_epoll(vm, reserved); JNI_OnUnload_netty_transport_native_epoll(vm, reserved);
} }
#endif /* NETTY_BUILD_STATIC */ #endif /* NETTY_BUILD_STATIC */

View File

@ -352,7 +352,7 @@ jint JNI_OnLoad_netty_transport_native_kqueue(JavaVM* vm, void* reserved) {
} }
#ifndef NETTY_BUILD_STATIC #ifndef NETTY_BUILD_STATIC
jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
return JNI_OnLoad_netty_transport_native_kqueue(vm, reserved); return JNI_OnLoad_netty_transport_native_kqueue(vm, reserved);
} }
#endif /* NETTY_BUILD_STATIC */ #endif /* NETTY_BUILD_STATIC */
@ -368,7 +368,7 @@ void JNI_OnUnload_netty_transport_native_kqueue(JavaVM* vm, void* reserved) {
} }
#ifndef NETTY_BUILD_STATIC #ifndef NETTY_BUILD_STATIC
void JNI_OnUnload(JavaVM* vm, void* reserved) { JNIEXPORT void JNI_OnUnload(JavaVM* vm, void* reserved) {
return JNI_OnUnload_netty_transport_native_kqueue(vm, reserved); return JNI_OnUnload_netty_transport_native_kqueue(vm, reserved);
} }
#endif /* NETTY_BUILD_STATIC */ #endif /* NETTY_BUILD_STATIC */