<AWT Dev> Define JNIEXPORT as visibility default with GCC?

David DeHaven david.dehaven at oracle.com
Tue Apr 9 08:39:56 PDT 2013

> [ cc'ing awt-dev@ ]
> Probably gcc can't process typedefs with visibility attributes specified, hence the changes to AWT. Generally they look good.

It's not necessary for those typedefs as those types are not being used to define exported functions. The way it was being used in awt_LoadLibrary.c doesn't make any sense. It shouldn't be used for typedefs at all, it's used to mark a specific function for export which has nothing to do with the functions signature.

> However, I'm concerned with the compatibility impact of this change. I suppose that 3rd-party JNI libraries could use such a pattern, too. And now their compilation may fail. I understand that this is just a source compatibility issue, not a binary compatibility. But I just want to make sure we're aware of it.

Unless gcc is also passed -fvisibility=hidden then this change has no effect, so it's an opt-in feature in that regard. This isn't changing the default visibility in the JDK JNI libs, so it should have no impact on the binaries. What it is doing is implementing a feature that wasn't implemented, allowing those who wish to trim their JNI libs to do so without further hackery (as such I wouldn't think a CCC needs to be filed).

Also, I'm not an official jdk8 reviewer so I'm not sure my name should be there (just wanted to point that out before someone got cranky about it :).


More information about the awt-dev mailing list