java calling a cpp dll

chris (garcia.91@osu.edu)
Wed, 30 Sep 1998 11:26:57 -0400


i have built a java executable to try to run the hello world sample, but
it doesn't quite work right. the program hangs after i get the message "
the current keyboard layout is 437". i wondered if anyone knows what is
going on??? i know some people have gotten this to work on a unix machine,
is this a windows nt problem?? Or perhaps I have made a dumb mistake
somewhere?? here is the c++ code for the procedure in the dll to call root.

JNIEXPORT void JNICALL
Java_Jhworld_callRoot (JNIEnv, jobject){

extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };

TROOT root("hello","Hello World", initfuncs);

printf("I am in callRoot \n");
int * argc= new int;
*argc=1;
char** argv=new char*;
*argv="app";

// TApplication theApp("App",argc,argv);

//int main(int argc, char **argv)
//{
TApplication theApp("App", argc, argv);

TCanvas *c = new TCanvas("c", "The Hello Canvas", 400, 400);

TPaveLabel *hello = new TPaveLabel(0.2,0.4,0.8,0.6,"Hello World");
hello->Draw();
c->Update();

// Enter event loop, one can now interact with the objects in
// the canvas. Select "Exit ROOT" from Canvas "File" menu to exit
// the event loop and execute the next statements.
theApp.Run(kTRUE);

TLine *l = new TLine(0.1,0.2,0.5,0.9);
l->Draw();
c->Update();

// Here we don't return from the eventloop. "Exit ROOT" will quit the app.
theApp.Run();

return;
}