Patch: New version of "UTF-16 to 'Win32 locale' conversions" and filenames (replacing convertion tables with Win32 API calls)

Andrew Haley aph@redhat.com
Fri Sep 19 15:06:00 GMT 2003


Mohan Embar writes:

 > >The problem is that SWT maps *foo onto int.  So, many Java methods
 > >are passed ints, but there's no type checking -- all that you know
 > >is you're passed a pointer to something, and you pass that to a
 > >native method.  All the type checking we've grown to love has
 > >gone.
 > 
 > But is there anyway around this, given that you're forced to use
 > JNI outside of the gcj world? The thing that dazzled me about the
 > SWT OS wrapper approach is that I can step through my OS calls
 > directly in the Java debugger.

That's why they did it, yes.  But it would have been possible to keep
type safety by putting the native pointers into container classes, at
some cost in efficiency.  And memcpy() is best kept well away from
Java, IMO.

 > I understand that there's a loss of type safety with some of the
 > mappings, but when I compare that to the hell I had to go through
 > trying to convince MS Visual Studio to fire up an instance of IBM
 > Visual Age in order to debug my JNI DLL, I was dancing on the
 > tables when I read about that approach.

Well, I don't know about that.  I used gdb, which wasn't perfect but
would debug the SWT bindings -- I could even step from Java through
gtk callbacks.

Andrew.



More information about the Java-patches mailing list