I'm attempting to play around with JNI for a project at work and am running into a few problems. Here's the setup for what I'm currently doing.
Say I have java class Calc with method bob. I also have a c dll with a method (say fred) that loads the jvm, looks up method bob in class Calc, calls it, and returns the answer to whoever called fred.
This all works if I compile the class and run the c executable. However, things start to fall apart when I get into dlls. When I compile the c program into a dll, and invoke method fred from another program (the one I want to do this from is excel) I get some weird results. The first time I call it I am able to call fred, which successfully calls bob, and display the result from fred.
However, when I try to run the macro in excell that calls fred a second time, I freeze up in my dll at the line JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args) and the computer just sits and spins. I suspect the problem is the JNI_CreateJavaVM method isn't returning. Now, at the end of method fred, I do get rid of the jvm I get with (*jvm)->DestroyJavaVM(jvm) so it should be cleaned up when I next call the method.
Does anybody have any clue what's going on here. As a side note, please do not reference sun's JNI tutorial as I've read through it (unless you know of a specific line in there that I might have missed that deals with this problem) and haven't found my answer there. Thanks for the help.
Currently this question is worth 200 points. However, if somebody gives especially usefull help I'll bump it up to 300 points. Thanks again.