Open engrvivs-neosoft opened 4 years ago
@engrvivs-neosoft have you managed to do this in the end? I tried using readPointer and get with an offset to get the next element but this results in "Buffer instance must be at least 32 bytes to back this struct type"
Oh I have finally found it. It was difficult because the full api doc of ref is missing but for anyone who falls onto this:
The buffer is allocated for only one structure by default (as it is a pointer) so you need to use the reinterpret
function:
// const structType = new StructType({…});
const myStructType = ref.refType(structType);
const result = myLibraryStruct.reinterpret(n * myStructType.size); // with n being the number of elements in the array
let el = ref.get(result, i * myStructType.size, structType); // retrieves the element in the array at rank i
Hi
Through list_buckets() C function, I am retrieving a C structure, BucketList, through ref-struct, defined as follows:
Here, I mainly need to access the "array" of BucketInfo, which I have declared as follows:
Although, I am able to access the first bucket's information, through BucketList.items. But, I am not able to "point" to the next bucket's information.
May someone hint, as to how I may access the next information?
Thank in Advance Vivs