4 messages in net.java.dev.jna.usersRe: [jna-users] struct vs &struct vs ...
FromSent OnAttachments
bb...@cox.netJul 16, 2007 9:21 am 
Timothy WallJul 16, 2007 11:54 am 
bb...@cox.netJul 17, 2007 4:45 am 
bb...@cox.netJul 17, 2007 4:53 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] struct vs &struct vs struct *Actions...
From:bb...@cox.net (bb@cox.net)
Date:Jul 17, 2007 4:53:03 am
List:net.java.dev.jna.users

---- Timothy Wall <twal@dev.java.net> wrote:

In almost all C programs, the only difference is whether you pass the structure ("by value") or a pointer to the structure. Usually if you pass the structure by value, changes made by the called function won't be visible to the caller. Structure by value is also not currently supported by JNA, at least not directly, since it's highly dependent on compiler specifics and has a whole host of corner cases that'd be a pain to support, and the usage is not that common.

After my previous email suggesting "in-lining" the structure fields, I had a second thought. Is it possible to add support for by-value structs by subclassing Structure and over-riding some choice methods? (And what would they be...) I understand that it wouldn't be adding support for all compilers and all cases, just my particular situation. I'm just wondering if there is a solution less ugly than in-lining those fields.

- Ben