Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNI_CreateJavaVM returns -1 in a DLL  RSS feed

 
J�rg Vater
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Windows 2000, MS VC 6.0 and JDK 1.4.2_03.
I have to call a java method in a dll, I did this successfully in a exe, but now I have to do this call in a dll. I get allways a -1 by calling JNI_CreateJavaVM. I also tried a dynamic load of the jvm.dll, I could load the jvm.dll, I also got the ProcAdress for JNI_CreateJavaVM, but if I call this function I get the same error. If there any difference in calling JNI_CreateJavaVM on exe and dll?
 
J�rg Vater
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I solve the problem by myself, the problem is the dll in which I call java. This dll is inside our system and anywhere in the system is the problem. If I create my own dll-File and load this dll, the java-call works in the same way like the exe.
 
J�rg Vater
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the solution for the problem: the JNI_CreateJavaVM is a pascal-style function call(this is the dll-normal way to call functions), our system call all dll-function with cdecl-style, I changed the definition of JNI_CreateJavaVM to

typedef int (PASCAL *createJVMTyp)(JavaVM **pvm, void **penv, void *args);

and it works.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!