Albert Strasheim wrote:
else if (arg instanceof Buffer) {
if (!(arg instanceof ByteBuffer) || !((ByteBuffer)arg).isDirect()) {
I think any direct buffer can be passed through, so it should probably
simply be:
else if (arg instanceof Buffer) {
if !((Buffer)arg).isDirect()) {
That would be nice, apart from the fact that Buffer.isDirect() didn't
appear until JDK 6 :-)
JNA needs to be JDK 1.4 and JDK 1.5 (for V3) compatible.
Also, it would be useful if I could write the function in the interface as:
void foo(Buffer buf);
and have it accept any direct buffer. Also, all the other variants
should also work, e.g.,
That should work now for any JDK provided direct Buffer (unless I missed
one).
void foo(FloatBuffer buf);
As far as I can tell, the tests don't cover these cases yet.
They do now.
I'm a bit uneasy about using undocumented behaviour here, since it could
break on other VMs (e.g. gcj, JRE 1.4?). Then again, without using the
undocumented behaviour, it won't work on them anyway, so we don't lose much.