6 messages in net.java.dev.jna.usersRE: [jna-users] Win32 WaitForMultipeO...
FromSent OnAttachments
Scott PalmerMar 10, 2009 8:46 am 
Timothy WallMar 10, 2009 9:18 am 
Scott PalmerMar 10, 2009 10:08 am 
Timothy WallMar 10, 2009 10:20 am 
Scott PalmerMar 10, 2009 11:16 am 
Timothy WallMar 10, 2009 11:28 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] Win32 WaitForMultipeObjects - no support for arrays of HANDLE?Actions...
From:Scott Palmer (scot@2connected.org)
Date:Mar 10, 2009 10:08:31 am
List:net.java.dev.jna.users

I don't understand how that will help. I already have a couple HANDLEs.. The API I need to call takes an array of HANDLEs, of length > 1.

Scott

-----Original Message----- From: Timothy Wall [mailto:twal@dev.java.net]

There is HANDLEByReference in com.sun.jna.examples.win32.W32API, but PointerByReference or Pointer[1] will also work.

Arrays of type-mapped types are not currently supported in every case.

On Mar 10, 2009, at 11:47 AM, Scott Palmer wrote:

As the subject indicates, I'm trying to call the Windows WaitForMultipleObjects method but I get this exception:

java.lang.IllegalArgumentException: Unsupported array argument type: class ca.digitalrapids.bindings.win32.W32API$HANDLE at com.sun.jna.Function.convertArgument(Function.java:514)

I was thinking I could work around it by making an array of the appropriate primitive type (int or long) depending on Pointer.SIZE, but I there isn't a way to get the native handle value from a HANDLE object as far as I can tell.

What's the best way to deal with this?

I currently declare the WaitForMultipleObjects method like this:

int WaitForMultipleObjects(int nCount, HANDLE [] handles, boolean bWaitAll, int dwMilliseconds);

Thanks,