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

Mohan Embar
Fri May 30 15:45:00 GMT 2003

Hi Jost,

>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.

You might have better luck with gcj 3.3, which is almost ready for prime
time and will be hosted on SourceForge shortly. Although this is my
personal build, I don't think it will be too different from the final

>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?

Yes. Ranjit Mathew has done an excellent job implementing JNI on MingW.
See thisiscool-gcc/examples/JNITest in my bundle for an example.

>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).

Lots of people are interested in this. The person who cracks this will
be elevated to the status of the guy who proved Fermat's Last Theorem.

Efforts are currently underway to resolve this "properly". In the meantime,
here is a thread that described my failed attempt to do this:

My next step was going to be to omit all of the AWT and Swing classes and
see if the link would owrk....

>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. :)

I don't know and have to rush off now. If 3.3 doesn't work for you, then
I'll look some more.

-- Mohan

More information about the Java mailing list