Win32 gcj: How to create a shared library and other w32 issues

Jost Boekemeier JBoekemeier@inetsoftware.de
Fri May 30 14:30:00 GMT 2003


I use the following test:

1.) create a shared library (either with gcc -shared test.c and with
dlltool).
2.) create a file natcStartJvm.c which registers native JNI functions (from
a shared library test.dll) and then starts processing.
3.) bind the two classes (natcStartJvm.c StartJvm.java) and the library
together.

I have first tested with gcc 3.2 (prerelease) from the current cygwin port.
So far everything worked except that threads are not supported by the port.

a) So I went on cross-compiling gcc 3.2 with with ranjit's patches and build
a native compiler. The first problem is now that the test does not compile
anymore because a _imp_JvCreateJavaVM is needed.  

b) I've made a second test and created a shared library with a method
Test.test(Object o) and then tried to call this method from within another
Java file resulting in a core dump.


First question:  Has anyone similar problems a) with JNI and b) calling a
shared library?  Has anyone build a native compiler which supports jni and
calls into shared libraries?

Second question:  How do I convert libgcj.a into a shared library - the
naïve method using dllwrap -export-everything -olibgcj.dll does not seem to
work.  Building libgcj as a shared library is necessary because the library
contains symbols (locale, calendar) which are dlloaded at run-time (which is
probably a bug).

Third question: Does anyone know how to ask for the available bytes after
opening a socket connection? -- gcj says that it is not supported on Win32,
but somehow I don't believe this. :)



Jost



More information about the Java mailing list