24 messages in net.java.dev.jna.usersRe: [jna-users] Re: Mapping Struct to...
FromSent OnAttachments
thex...@email.comNov 1, 2008 1:46 am 
Timothy WallNov 1, 2008 5:04 am 
thex...@email.comNov 1, 2008 8:40 am 
Timothy WallNov 1, 2008 11:14 am 
Timothy WallNov 1, 2008 11:17 am 
thex...@email.comNov 2, 2008 12:30 am 
Timothy WallNov 2, 2008 7:42 am 
thex...@email.comNov 3, 2008 2:02 am 
Timothy WallNov 3, 2008 3:49 am 
thex...@email.comNov 3, 2008 4:51 am 
Timothy WallNov 3, 2008 6:22 am 
thex...@email.comNov 3, 2008 7:47 am 
Timothy WallNov 3, 2008 8:21 am 
thex...@email.comNov 3, 2008 11:19 pm 
Timothy WallNov 4, 2008 5:33 am 
Timothy WallNov 4, 2008 5:34 am 
thex...@email.comNov 4, 2008 2:33 pm 
Timothy WallNov 5, 2008 5:44 am 
thex...@email.comNov 5, 2008 8:15 am 
Timothy WallNov 5, 2008 9:19 am 
thex...@email.comNov 5, 2008 3:22 pm 
Timothy WallNov 5, 2008 7:00 pm 
thex...@email.comNov 6, 2008 3:36 am 
thex...@email.comNov 6, 2008 10:55 pm 
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] Re: Mapping Struct to JavaActions...
From:thex...@email.com (thex@email.com)
Date:Nov 3, 2008 4:51:19 am
List:net.java.dev.jna.users

Hi

The DLL won't carry any struct information. That's all generated by the compiler based on the header file.

Oh, I see now. Its a contract not a structure. Sign the wrong contract paragraphs and you get wrong results.

Not sure when I'll get the chance. It's straightforward to add a new JNA test to verify the behavior (including a native method that returns an int-sized struct, if there isn't one already). That might've been easier than writing a vc++ dll :)

I see. Any help I can offer you with it? Took a quick look at the tests in the repository: StructureByValueTest checks values with 8, 16, 32, 64 and 128 byte length.

PointerByReference is "void **", which you use if you're expecting the native code to provide you with a value (the native code writes a "void *" into the pointer-sized memory you provide). byte[] is if you're providing the native code with a buffer in which to write. Use the wrong one and you'll get an access violation.

Strangely the tests with that JNA definition using PointerByReference for returned a string worked without access violation as long as I didn't use the function returning the 4-byte-structure. But as said, gonna go change that anyway.

Regards, Armin