Skip to content

Commit

Permalink
- Add JNIEXPORT to JLI_IsStaticJDK.
Browse files Browse the repository at this point in the history
- Fix errornous dlsym call for isStaticJDK check in AWT_OnLoad.
  • Loading branch information
jianglizhou committed Aug 9, 2023
1 parent a7ab571 commit 9e3c81b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/java.base/share/native/libjli/java.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#define SPLASH_JAR_ENV_ENTRY "_JAVA_SPLASH_JAR"
#define JDK_JAVA_OPTIONS "JDK_JAVA_OPTIONS"

jboolean JLI_IsStaticJDK();
JNIEXPORT jboolean JLI_IsStaticJDK();
void JLI_SetStaticJDK();
// FIXME: Add non-unix implementation.
void* JLI_Lookup_Set_Static_JDK();
Expand Down
3 changes: 2 additions & 1 deletion src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
jvm = vm;

// IsStaticJDK is defined by libjli. Check if it is statically linked.
jboolean isStaticJDK = (dlsym(NULL, "IsStaticJDK") != NULL);
IsStaticJDK = (JLI_IsStaticJDK_t)dlsym(RTLD_DEFAULT, "JLI_IsStaticJDK");
jboolean isStaticJDK = (IsStaticJDK != NULL) && (IsStaticJDK)();
if (!isStaticJDK) {
/* Get address of this library and the directory containing it. */
dladdr((void *)AWT_OnLoad, &dlinfo);
Expand Down

0 comments on commit 9e3c81b

Please sign in to comment.