8 messages in net.java.dev.jna.usersRe: [jna-users] Is there a way to han...
FromSent OnAttachments
Dennis PortelloMay 14, 2007 7:27 am 
Wayne MeissnerMay 14, 2007 5:59 pm 
Dennis PortelloMay 15, 2007 10:48 pm 
Wayne MeissnerMay 16, 2007 3:54 am 
Timothy WallMay 16, 2007 5:51 am 
Timothy WallAug 27, 2007 9:53 am 
Dennis PortelloAug 27, 2007 9:59 am 
Timothy WallAug 27, 2007 11:27 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] Is there a way to handle a union construct?Actions...
From:Wayne Meissner (wmei@gmail.com)
Date:May 16, 2007 3:54:56 am
List:net.java.dev.jna.users

Dennis Portello wrote:

Thank you!

I'm intrigued by the example you provided (and this entire project).

If you want an example of some non-trivial JNA usage, have a look at http://code.google.com/p/gstreamer-java/

Thats a java binding to the gstreamer framework - written entirely in java using JNA, no custom JNI code at all. Even video output into a JComponent works. Not all the JNA using code in there is pretty, but I was able to do some pretty twisted things using it.

I've been looking at the Structure class to see if I could derive a Union class from it. My C is a bit rusty these days, so I'm looking for a nice challenge.

Unions are a bit tricky to implement properly in JNA. Although a Union class could be implemented, where it maps each of its members to the same memory area (basically the same as my example), there is no way for JNA to know which one of those members holds the most recently modified values that need to be written out to native memory.