Problem compiling DLL

Andrew Haley aph-gcc@littlepinkcloud.COM
Wed Sep 5 10:42:00 GMT 2007


Daniel Adolfsson writes:
 > If I compile HelloWorld against libgcj DLL, and without
 > -findirect-dispatch - then try to run it...
 > 
 > gcj -o HelloWorld.exe --main=HelloWorld --classpath=. -L. -ltest HelloWorld.java
 > 
 > HelloWorld.exe
 > Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
 >    at java.lang.Class.initializeClass(gcj.dll)
 > Caused by: java.lang.NullPointerException
 >    <<No stacktrace available>>

Aha!  A NullPointerException.  That is an important clue.

 > If I, in the other hand use -findirect-dispatch, the output would be
 > "Hello, World".
 > 
 > Also, if I try to use a Test DLL, as soon as I try to use the class it
 > would throw an exception when I run it:
 > 
 > gcj -shared -o Test.dll -Wl,--out-implib,libtest.a

I'm not sure what is going on here.  What is being linked into Test.dll ?

 > gcj -o HelloWorld.exe --main=HelloWorld --classpath=. -L. -ltest
 > HelloWorld.java -findirect-dispatch
 > 
 > HelloWorld.exe
 > Exception in thread "main" java.lang.NoClassDefFoundError: Test
 >    at HelloWorld.<init>(HelloWorld.exe)

Where is the compiled code for the class called "Test" supposed to be?
It's in neither Test.dll nor HelloWorld.exe.

Andrew.



More information about the Java mailing list