29 messages in net.java.dev.jna.usersAW: [jna-users] Struct with Union wit...
FromSent OnAttachments
Wolfgang PichlerMar 25, 2009 5:58 am 
Timothy WallMar 25, 2009 7:02 am 
Timothy WallMar 25, 2009 7:06 am 
Wolfgang PichlerMar 25, 2009 7:21 am 
Timothy WallMar 25, 2009 7:24 am 
Wolfgang PichlerMar 25, 2009 8:11 am 
Wolfgang PichlerMar 25, 2009 8:20 am 
Novatchkov HristoMar 25, 2009 8:41 am 
Timothy WallMar 25, 2009 9:59 am 
Timothy WallMar 25, 2009 10:28 am 
Timothy WallMar 25, 2009 10:38 am 
Hristo NovatchkovMar 25, 2009 11:40 am 
Wolfgang PichlerMar 25, 2009 12:02 pm 
LYou...@gkservices.comMar 25, 2009 12:11 pm 
Timothy WallMar 25, 2009 12:52 pm 
Wolfgang PichlerMar 26, 2009 12:22 am 
Timothy WallMar 26, 2009 4:46 am 
Wolfgang PichlerMar 26, 2009 5:23 am 
Timothy WallMar 26, 2009 6:09 am 
Wolfgang PichlerMar 26, 2009 6:13 am 
Wolfgang PichlerMar 26, 2009 6:26 am 
Timothy WallMar 26, 2009 6:40 am 
Wolfgang PichlerMar 26, 2009 12:22 pm 
Timothy WallMar 26, 2009 1:00 pm 
Wolfgang PichlerMar 26, 2009 3:15 pm 
Timothy WallMar 30, 2009 6:06 am 
Wolfgang PichlerMar 30, 2009 11:55 am 
Timothy WallMar 30, 2009 12:14 pm 
Wolfgang PichlerMar 31, 2009 12:35 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:AW: [jna-users] Struct with Union with Structs...Actions...
From:Wolfgang Pichler (wpic@callino.at)
Date:Mar 25, 2009 7:21:04 am
List:net.java.dev.jna.users

The code does not produce an exception or a crash... - but it does return wrong values.

I will return nulled values - but there are real values - as I have seen when I do directly use the registration structure instead of the union. It does look like it does not get initialized...

Regards, Wolfgang

-----Ursprüngliche Nachricht----- Von: Timothy Wall [mailto:twal@dev.java.net] Gesendet: Mittwoch, 25. März 2009 15:07 An: use@jna.dev.java.net Betreff: Re: [jna-users] Struct with Union with Structs...

On Mar 25, 2009, at 8:59 AM, Wolfgang Pichler wrote:

Here is the callback function IAXClient.INSTANCE.iaxc_set_event_callback(new IAXClient.FUNCTION() { @Override public int invoke(iaxc_event_struct.ByValue event) { if (event==null) { return 0; } switch(event.type) { case IAXClient.IAXC_EVENT_REGISTRATION: System.out.println("Event Raw: " + event.ev.toString());

event.ev.setType(IAXClient.iaxc_ev_registration.class); event.ev.read(); IAXClient.iaxc_ev_registration reg = (iaxc_ev_registration) event.ev.getTypedValue(IAXClient.iaxc_ev_registration.class); System.out.println("Event Reg: " + reg.reply); break;

Once you've called "read", you can simply access the corresponding union field. getTypedValue is a shortcut for setType + read. How exactly does this code fail?