RFR(S): 8043491: warning LNK4197: export '... ...' specified multiple times; using first specification

Calvin Cheung calvin.cheung at oracle.com
Tue Nov 11 06:12:46 UTC 2014


This is for fixing link warnings on windows such as the following:
jni.obj : warning LNK4197: export 'JNI_CreateJavaVM' specified multiple 
times; using first specification

The warning is reproducible with both VS2010 and VS2013.
It is applicable to 64-bit only probably due to the 
__declspec(dllexport) on 32-bit, it exports the function decorated name 
with a leading underscore, but not the case on 64-bit as described in:
http://stackoverflow.com/questions/3572344/a-warning-with-building-64bit-dll

All those functions are declared with JNIEXPORT (#define JNIEXPORT 
__declspec(dllexport)) and we're adding the /export:<function name> in 
the link command. Therefore, on 64-bit platform, we get the "specified 
multiple times" LNK4197 warning.

A fix is to check if the platform is 64-bit, we don't add those /export 
option to the link command.

JBS: https://bugs.openjdk.java.net/browse/JDK-8043491

webrev: http://cr.openjdk.java.net/~ccheung/8043491/webrev/

Tests:
     (1) build jvm.dll via command line (both 32- and 64-bit)
           use configure.sh to setup and then do "make CONF=<config> 
hotspot"

     (2) generate visual studio project files using ProjectCreator (both 
32- and 64-bit)
           build jvm.dll via VS2013 (both 32- and 64-bit)

     (3) JPRT

thanks,
Calvin





More information about the hotspot-runtime-dev mailing list