run JNI_OnLoad if found in ClassLoader.loadLibrary

This commit is contained in:
Joel Dice 2012-03-18 20:10:42 -06:00
parent 674c560494
commit 4f0d275e13
2 changed files with 11 additions and 1 deletions

View File

@ -120,6 +120,16 @@ void
runOnLoadIfFound(Thread* t, System::Library* library)
{
void* p = library->resolve("JNI_OnLoad");
#ifdef PLATFORM_WINDOWS
if (p == 0) {
p = library->resolve("_JNI_OnLoad@8");
if (p == 0) {
p = library->resolve("JNI_OnLoad@8");
}
}
#endif
if (p) {
jint (JNICALL * JNI_OnLoad)(Machine*, void*);
memcpy(&JNI_OnLoad, &p, sizeof(void*));

View File

@ -1747,7 +1747,7 @@ loadLibrary(Thread* t, object, uintptr_t* arguments)
loadLibrary
(t, static_cast<local::MyClasspath*>(t->m->classpath)->libraryPath,
RUNTIME_ARRAY_BODY(n), not absolute, false);
RUNTIME_ARRAY_BODY(n), not absolute, true);
}
// only safe to call during bootstrap when there's only one thread