Is it possible to static link jvm?
Isml
76069016 at qq.com
Thu Sep 12 02:17:44 PDT 2013
Hi, everyone!
I am reading launcher code(hotspot7u\src\share\tools\launcher etc.) in the hotspot project and see some comments like this(in file hotspot7u\src\os\windows\launcher\java_md.c, line 434):
jboolean
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
{
#ifdef GAMMA
/* JVM is directly linked with gamma launcher; no Loadlibrary() */
ifn->CreateJavaVM = JNI_CreateJavaVM;
ifn->GetDefaultJavaVMInitArgs = JNI_GetDefaultJavaVMInitArgs;
return JNI_TRUE;
#else
It seems that jvm could be staticly linked. So I just do some try. After some tiny modifications, I successfully compiled it and link the jvm. But when I run it, it fails with error "unable to find jvm.dll". I debug the code, and find the actual reason why it failes(src\share\vm\runtime\os.cpp, line 385):
void* os::native_java_library() {
dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "verify");
dll_load(buffer, ebuf, sizeof(ebuf));
// Load java dll
dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "java");
_native_java_library = dll_load(buffer, ebuf, sizeof(ebuf));
verify.dll and java.dll is designed to be load here, and they all depends on jvm.dll!
Now I do not how to do, any idea?
More information about the hotspot-dev
mailing list