385 |
385 |
386 // Converts a C string to a Java String based on current encoding |
386 // Converts a C string to a Java String based on current encoding |
387 Handle java_lang_String::create_from_platform_dependent_str(const char* str, TRAPS) { |
387 Handle java_lang_String::create_from_platform_dependent_str(const char* str, TRAPS) { |
388 assert(str != NULL, "bad arguments"); |
388 assert(str != NULL, "bad arguments"); |
389 |
389 |
390 typedef jstring (*to_java_string_fn_t)(JNIEnv*, const char *); |
390 typedef jstring (JNICALL *to_java_string_fn_t)(JNIEnv*, const char *); |
391 static to_java_string_fn_t _to_java_string_fn = NULL; |
391 static to_java_string_fn_t _to_java_string_fn = NULL; |
392 |
392 |
393 if (_to_java_string_fn == NULL) { |
393 if (_to_java_string_fn == NULL) { |
394 void *lib_handle = os::native_java_library(); |
394 void *lib_handle = os::native_java_library(); |
395 _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "NewStringPlatform")); |
395 _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "JNU_NewStringPlatform")); |
|
396 #if defined(_WIN32) && !defined(_WIN64) |
396 if (_to_java_string_fn == NULL) { |
397 if (_to_java_string_fn == NULL) { |
397 fatal("NewStringPlatform missing"); |
398 // On 32 bit Windows, also try __stdcall decorated name |
|
399 _to_java_string_fn = CAST_TO_FN_PTR(to_java_string_fn_t, os::dll_lookup(lib_handle, "_JNU_NewStringPlatform@8")); |
|
400 } |
|
401 #endif |
|
402 if (_to_java_string_fn == NULL) { |
|
403 fatal("JNU_NewStringPlatform missing"); |
398 } |
404 } |
399 } |
405 } |
400 |
406 |
401 jstring js = NULL; |
407 jstring js = NULL; |
402 { |
408 { |