If the host system is returning a pointer of any type, then you
should use a PointerByReference, and then extract the desired type
from the returned Pointer, for example:
PointerByReference ip = new PointerByReference();
IntByReference ic = new InteByRefreence();
callMyOSFunction(ip, ic);
Pointer p = ip.getValue();
int[] data = p.getIntArray(0, ic.getValue());
You are of course responsible for whatever memory is allocated by the
native call and usually need to pass the returned Pointer to some
other native call to free it.
On May 31, 2007, at 12:08 PM, Carlos Domingues wrote:
Dears,
(Sorry my english)
I tested your project with Windows Psapi in order to create a
function that lists Windows Proccess (tasks).
I found a different data type: A pointer to Array of Long elements
(by reference).
To resolv I extend ByReference class in order to create
BufferByReference class. This is applicable to any kind of array or
string.
I am sending the solution to you. It´s applicable to your project,
I hope (see attachments).
Thank you,
Carlos Domingues
car...@cjdinfo.com.br
<BufferByReference.java>
<Kernel32.java>
<PsApi.java>
<taskCtrl.java>