Define JNIEXPORT as visibility default with GCC?
Anthony Petrov
anthony.petrov at oracle.com
Wed Apr 10 01:45:00 PDT 2013
I totally agree that the current usage of JNIEXPORT in typedefs in AWT
and 2D code is a bug.
My concern, however, is about other code that mistakenly adapted the
same pattern. After this fix its compilation will fail.
--
best regards,
Anthony
On 4/9/2013 19:39, David DeHaven wrote:
>> [ 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 :).
>
> -DrD-
>
More information about the jdk8-dev
mailing list