Hi,
I have structure A,B and C.
public class A extends Structure
{
public A() {
super(-1, ALIGN_NONE);
}
public byte[] aField1 = new byte[3];
public NativeLong aField2;
public short aField3;
public Pointer aField4;
public NativeLong aField5;
public void useMemory(Pointer p)
{
super.useMemory(p);
}
}
public class B extends Structure
{
public B() {
super(-1, ALIGN_NONE);
}
public short bFild1;
public NativeLong bField2;
public short bField3;
public Pointer bField4
public NativeLong bField5;
}
public class C extends Structure
{
public C() {
super(-1, ALIGN_NONE);
}
public NativeLong[] cFild1= new NativeLong[5];
}
I invoke my C function passing structure A, where i set A.aFild4 =
B.getPointer() and B.bFild3 = C.getPointer(), see the example:
A a = new A();
a.aFild1 = 0;
a.aFild2 = 1;
B b = new B();
b.bField1 = "ABC".getBytes();
b.bField2= new NativeLong(20);
b.bField3 = 1;
C c = new C();
NativeLong[] values = new NativeLong[5];
values[0] = new NativeLong(1);
values[1] = new NativeLong(0);
values[2] = new NativeLong(0);
values[3] = new NativeLong(0);
values[4] = new NativeLong(0);
c.cField1 = values;
b.bField4 = numerario.getPointer();
b.bField5 = new NativeLong(0);
a.aField4 = b.getPointer();
B oP = new B();
oP.useMemory(a.aField4); //I just set with b.getPointer()
oP.read();
System.out.println(oP);//Here print B Structure with all attributes
NULL or Zero
Here print B Structure with all attributes NULL or Zero (the same with new
B()) and when I invoke my C Function response is a error, that is my
problem...
somebody help me?