On Fri, 31 Jul 2026 01:56:23 GMT, Albert Mingkun Yang <[email protected]> wrote:
> I think that's intentional. LoadLibrary(NULL) just returns NULL, whereas > dlopen(NULL) returns the main executable For LoadLibrary it might be okay to pass in NULL (however I see no mentioning of it at https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya ). However we have TRACE1 before LoadLibrary to print stuff with fprintf const char *getFunctionListStr; const char *libraryNameStr = (*env)->GetStringUTFChars(env, jPkcs11ModulePath, 0); TRACE1("DEBUG: connect to PKCS#11 module: %s ... ", libraryNameStr); And this seems to be undefined behavior https://stackoverflow.com/questions/11589342/what-is-the-behavior-of-printing-null-with-printfs-s-specifier (in practise it seems not to crash in the environments we ship OpenJDK, but still not really nice) ------------- PR Comment: https://git.openjdk.org/jdk/pull/32103#issuecomment-5143608243
