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.