4 messages in net.java.dev.jna.usersRe: [jna-users] Help mapping VMware V...
FromSent OnAttachments
step...@one-dash.comSep 27, 2007 7:57 am 
Timothy WallSep 27, 2007 8:28 am 
Timothy WallSep 27, 2007 10:13 am 
Stephen ConnollySep 27, 2007 10:44 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] Help mapping VMware VIX libraries (varargs related)Actions...
From:Timothy Wall (twal@dev.java.net)
Date:Sep 27, 2007 8:28:32 am
List:net.java.dev.jna.users

You should be able to simply define the interface as a varargs method and everything else should work properly.

int VixJob_Wait(int jobHandle, int firstPropertyID, ...);

Of course, you'll need to use Java 1.5 for varargs support. Otherwise you can call the Function object directly, passing an Object [] for the arguments, which all get pushed to the stack in an appropriate manner.

Be sure to represent any NULL-valued pointers with 'null', not '0'.

On Sep 27, 2007, at 10:57 AM, step@one-dash.com wrote:

Here is one of the critical methods I need to call:

/* * Synchronization functions * (used to detect when an asynch operation completes). */

VixError VixJob_Wait(VixHandle jobHandle, VixPropertyID firstPropertyID, ...);

All of these typedefs are for int's... so this is realy

int VixJob_Wait(int jobHandle, int firstPropertyID, ...);

Now for the fun...

You call this method passing a series of pairs of value, pointer terminated with a single 0... e.g.

int hostHandle; err = VixJob_Wait(jobHandle, 3010, &hostHandle, 0);

or

int handle; char buf[2048]; err = VixJob_Wait(jobHandle, 3010, &hostHandle, 3005, buf, 0);

How do I implement this with JNA... or is it Sorry Out Of Luck