3 messages in net.java.dev.jna.usersRe: [jna-users] incorrect call-by-val...
FromSent OnAttachments
David MonniauxMar 13, 2008 8:01 am 
David MonniauxMar 13, 2008 8:49 am 
Timothy WallMar 13, 2008 10:30 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] incorrect call-by-value semantics?Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Mar 13, 2008 10:30:58 am
List:net.java.dev.jna.users

On Mar 13, 2008, at 11:01 AM, David Monniaux wrote:

Platform: IA32 Linux, if that matters.

There is I think something wrong with the way that JNA handles objects that are returned-by-value by a C function (here, f1), then later passed by reference to another C function (here, f2). These objects carry a dynamic type implementing the interface Structure.ByValue, even though their static type does not. When JNA calls the f2 function, it apparently tests whether to pass the parameter by value or by reference not according to the type signature of f2 (type Foobar vs type Foobar.ByValue) but according to the dynamic type of the parameter.

You are correct. This has been fixed in SVN so that a structure is passed as a by-value parameter only if there is no method signature or the method signature also indicates ByValue.

Thanks for the detailed report.