Hi folks, Pardon if this has come up before; a quick search didn't indicate anything, but the mailing list archives are kind of hard to search.
I wonder if it makes sense to define JNIEXPORT as meaning __attribute__ ((visibility ("default"))) when compiling with gcc. Currently, anyone building JNI code with -fvisibility=hidden and a stock Oracle JDK is at a loss: their JNI exports will be hidden along with everything else. I notice that both IcedTea and OS X have made this change independently, and it has been added to Hotspot's JNIEXPORT definition (so HS can be built with -fvisibility=hidden), but the change isn't present in the latest JDK8 bits: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/933742f4bb4c/src/solaris/javavm/export/jni_md.h The workaround is pretty ugly: people who want to use -fvisibility=hidden have to redefine JNIEXPORT. Upstream, it would be a pretty simple change to jni_md.h, along the lines of: #if defined(__GNUC__) && __GNUC__ >= 4 #define JNIEXPORT __attribute__ ((visibility ("default"))) #else #define JNIEXPORT #endif Any thoughts? Jeremy