Define JNIEXPORT as visibility default with GCC?

David DeHaven david.dehaven at
Fri Feb 15 16:19:09 UTC 2013

>> a) I don't know what's going on behind the scenes, but if this sounds
>> like a good idea to folks, can we open a bug and get the process
>> otherwise rolling?
>> b) Martin, where did the 4.2 restriction come from?  Both Apple's site
>> and the gcc wiki say that visibility support arrived in 4.0:
> From the original push for 6588413 in linux gcc.make:
> +# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
> +# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
> So it was limited on x86 to >2 (which I think was a typo: intended to be >=2 or >1 ?)
> Of course the bsd port copied the linux file.

That makes sense. Is 4.1.2 in use any more? Was the warning due to -fvisibility=hidden or the __attribute__? The attribute should be benign as it's the default setting unless you explicitly set visibility when running the compiler, it only has effect when you compile with visibility != default so I see no harm in using it.


More information about the core-libs-dev mailing list