Hello,
Yesterday night, I have worked to try solve this problem. Interesting challenge
![Smiley :)](https://forums.codeblocks.org/Smileys/default/smiley.gif)
. The problem of the java exception is not IMHO a C::B bug.
Several users have had such issue. Just look at here for descriptions and solutions (which could work or not :?):
http://forum.java.sun.com/thread.jspa?threadID=570194&tstart=29The problem is that the GNU GCC generates a not correct def file. Therefore, the DLL is not create correctly. As a consequence, Java loads the library, but the method cannot be found (bad signature, I think). This generates the UnsatisfiedLinkError.
Instead MS Toolkit 2003 and (I have read) Borland compiler create a valid DLL (and a valid def/exp file).
In the Java thread mentioned above, a user suggests:
GOTCHA: I found the option to solve the compiling problem with MinGW gcc. Use this command line:
gcc -shared -o bridgeC.dll bridgeC.o bridgeC.def
Inside the .def file, only describe the right function name:
--- bridgeC.def ----
EXPORT
sayHelloWorld
--- bridgeC.def ----
The compiler will say something like: Warning: linking sayHelloWorld to sayHelloWorld@2 , but the DLL will work.
This solution worked for me too, but only if I call gcc directly by using a command dos window. By using C::B, it did not work. I suppose that I could not configure C::B correctly or I have missed something. I have tried with C::B RC2 and SVN rev1447 with no positive results. I have also used MinGW that come with the release of C::B and another that I have installed with MSYS. Same result.
May be it could be possible to use a makefile, but I did not try it (sorry, but I am not a makefile expert :oops:).
You can try to look at wich compiler/link options use Dev-C++ and import them in C::B. You can also try the same MinGW that Dev-C++ uses.
Best wishes,
Michael