On Feb 10, 2009, at 6:16 PM, Hao Jiang wrote:
Hi,
I just found this tool and hope it can solve my problem, I'm in a
rush to finish some work so will really appreciate if someone can
help me out
Basically I need to access 2 functions in a dll
int Load
( const char* aFilename,
Handle* aLayer,
int aLoadFlags);
typedef void* Handle;
here I translate it into java function
int load(String fName, PointerByReference pr, int flag);
It seems working, the return int is an error code which tells me no
error.
Then I need to call this function
const Info* Info
(
Handle aLayer
);
Here Info is a structure and I've created class for it extends
Structure, I translate this function in java like this
Pointer Info(Pointer p);
Call it after the first function
PointerByReference pr = new PointerByReference(); Int error =
load("a.txt", pr, 0); Pointer p = Info(pr.pr.getPointer());
Use pr.getValue(), not pr.getPointer(). The former is the returned
pointer value, the latter is the address where the value was stored.
No error so far, I just have no idea how to continue to get
structure (Info) out of Pointer (p)
Thanks for any help
Hao
Structure.useMemory(Pointer) followed by Structure.read(). Or simply
declare the return type to be your structure type.