[libbluray-devel] [PATCH] VM loading for win32 dll's

hpi hpi.libbluray at gmail.com
Sun Mar 27 14:02:39 CEST 2011


Erik Van Grunderbeeck wrote:
> This fixes loading VM’s for Win32. I general, its a known problem
> since 2004 or so (just google for “JNI_CreateJavaVM crash”). 
[...]
> Do direct load of Java VM through LoadLibrary on Win32. Loading
> through dl_sym() will destroy the function pointers on a 64 bit VM on
> Win32 (not sure for *Nix)
[...]
> -    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)dl_dlsym(jvm_lib,
> -            "JNI_CreateJavaVM");
> -
> +#ifdef WIN32
> +    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)GetProcAddress(jvm_lib, "JNI_CreateJavaVM");
> +#else  //      #ifdef WIN32
> +    fptr_JNI_CreateJavaVM JNI_CreateJavaVM_fp = (fptr_JNI_CreateJavaVM)dl_dlsym(jvm_lib, "JNI_CreateJavaVM");
> +#endif //      #ifdef WIN32

If GetProcAddress() returns pointer (32-bit in Win32), I can't see how
those two differ ? dl_dlsym() is just a wrapper for GetProcAddress().

GetProcAddress() definetely can't return 64-bit pointer when compiled
for Win32 ; that would break backward compability in Win32 API ?




More information about the libbluray-devel mailing list