For checking the size in C use sizeof. Write a small C program that prints
sizeof(ADK_DATA) or whatever stucture you want to check. ( if you are using
a C compiler instead of C++ it might be sizeof(struct ADK_DATA) ) In java
just use size() method of Structure class on a structure instance. They
should match. Otherwise there is probably something wrong with your mapping.
-Daniel
On Sun, May 17, 2009 at 11:23 AM, Johan Lund <joh...@risken.se> wrote:
This is how I read stings and double's might be the problem!!?
public String getAdkStr(AdkLibrary.ADK_DATA adkData, int iFieldId){
if(getAdkType(adkData, iFieldId)==2){
IntByReference iLength=new IntByReference();
AdkGetLength(adkData, iFieldId, iLength);
Memory mem = new Memory(iLength.getValue());
PointerByReference pref = new PointerByReference(mem);
AdkGetStr(adkData, iFieldId, pref, iLength.getValue());
Pointer p = pref.getValue();
byte[] buffer = p.getByteArray(0, iLength.getValue());
return Native.toString(buffer);
}else
System.err.println("Wrong fieldtype, tried String.");
return null;
}
public double getAdkDouble(AdkLibrary.ADK_DATA adkData, int iFieldId){
if(getAdkType(adkData, iFieldId)==4){
DoubleBuffer pdValue=DoubleBuffer.allocate(1);
AdkGetDouble(adkData, iFieldId, pdValue);
return pdValue.get();
}else
System.err.println("Wrong fieldtype, tried Double.");
return -1;
}