bug in Java JNI file iowkitjni.c affecting 64b linux

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
Posts: 1
Joined: Sat Oct 08, 2011 3:37 pm
Location: Venlo, Netherlands

bug in Java JNI file iowkitjni.c affecting 64b linux

Post by homberghp »


I found that custom IO warrior modules I have been using successfully with both windows, mac and Linux do not function properly under
a 64 bit version of linux (in my case Ubuntu 11.04).

I found the methods to convert between Handles and JLongs to be suspect, in particular
jlong HandleToJLong(IOWKIT_HANDLE handle)
return (jlong) ((int) handle);

IOWKIT_HANDLE JLongToHandle(jlong handle)
return (IOWKIT_HANDLE) ((int) handle);
I think the (int) casts are misplaced.

After some searching I found that the following change in code helps:
#define HandleToJLong(h) ((jlong)(h))
#define JLongToHandle(h) ((IOWKIT_HANDLE)(h))
which is consistent with the definitions of the types jlong and IOWKIT_HANDLE.

This has also the side effect that it is a macro expansion, saving the call return overhead in the original.

I was able to test it under 32 bit Linux (my office laptop) and my home pc which runs the said 64 bit ubuntu version.)
It would be nice if someone would update the iowarrior SDK distribution.
Kind regards,

Pieter van den Hombergh.
BTW we are using the iowarrior in our courses since 2007 as you may find onhttp://prj32.fontysvenlo.org.
Post Reply