OpenGL works! Was: Re: GCJ and OpenGL under Win32

Wed Jan 12 01:11:00 GMT 2005

Tom Tromey wrote:

>Sal> I finally figured the problem out.  I rebuilt the SWT OpenGL dll with
>Sal> mingw32, for some reason Sun's VM loads mangled names in JNI dlls and
>Sal> GCJ doesn't.
>That is strange, since we have special Windows code in our JNI
>implementation to do the mangling.  That is, if you mean mangling like
>appending "@NNN" to the function name.  Can you describe more what is
>going wrong?  What you expected, what the symbol names are, and what
>they are after you recompiled?
>Maybe there's a bug in our code.  If so that could even be a
>regression... what version are you using again?

Ok I'll rehash what happened in case it helps any:

I tried the application under Sun's VM, it worked fine. Then, tried to 
run a GCJ compiled OpenGL app with SWT's stock gl-win32.dll and recieved:

Exception in thread "main" java.lang.UnsatisfiedLinkError: gluPerspective
   at 0x00651f8e (Unknown Source)
   at 0x00651962 (Unknown Source)
   at 0x006528d4 (Unknown Source)
   at 0x006962e4 (Unknown Source)
 [... etc ...]

Then tried to figure out what was wrong with the DLL...

Here are snippits I got using: dumpbin -exports gl-win32.dll

 From 'Original' (probably msvc built) SWT OpenGL DLL:
        261  104 00004828 
        262  105 00004835 _Java_org_eclipse_swt_opengl_GL_glPushMatrix@8
        263  106 0000483E _Java_org_eclipse_swt_opengl_GL_glPushName@12
        264  107 0000484B _Java_org_eclipse_swt_opengl_GL_glRasterPos2d@24
        265  108 00004866 _Java_org_eclipse_swt_opengl_GL_glRasterPos2dv@12

I thought maybe the leading underscore and trailing '@' confused GCJ... 
so rebuilt the DLL using mingw32:

'mingw32 enhanced' DLL:
        261  104 00007EF9 Java_org_eclipse_swt_opengl_GL_glPushClientAttrib
        262  105 00007F11 Java_org_eclipse_swt_opengl_GL_glPushMatrix
        263  106 00007F20 Java_org_eclipse_swt_opengl_GL_glPushName
        264  107 00007F38 Java_org_eclipse_swt_opengl_GL_glRasterPos2d
        265  108 00007F57 Java_org_eclipse_swt_opengl_GL_glRasterPos2dv

Using this DLL the application works.  I'm not sure why/how the Sun VM 
gets around the mangling.

Compiler info:

gcc -v
Reading specs from 
Configured with: /datal/gcc/gcc/configure 
--prefix=/datal/gcc/build/wingcc --bui
ld=i686-pc-linux-gnu --host=i686-pc-mingw32 --target=i686-pc-mingw32 
nguages=c,c++,java --with-gcc --with-gnu-as --with-gnu-ld 
 --disable-nls --disable-win32-registry --disable-shared --disable-debug 
ut-newlib --enable-libgcj --disable-java-awt --without-x 
--disable-libgcj-debug --enable-interpreter 
--enable-hash-synchronization --enab
le-sjlj-exceptions --enable-libgcj-multifile 
Thread model: win32

gcc version 4.0.0 20040924 (experimental)

Hope this helps!!!!

- Sal

More information about the Java mailing list