jnr / jnr-ffi

Java Abstracted Foreign Function Layer
Other
1.26k stars 157 forks source link

Multi-dimensional arrays as struct members #325

Closed Tianscar closed 1 year ago

Tianscar commented 1 year ago

I'm writing bindings for libwebp using jnr-ffi, and while mapping the structs, I got a problem:

struct WebPAuxStats {
  ...
  int residual_bytes[3][4];  // approximate number of bytes spent for
                             // DC/AC/uv coefficients for each (0..3) segments.
  ...
};

The struct WebPAuxStats has a 2-d array among its members, but, as I can use the array() method for 1-d arrays, I cannot find similar methods for 2-d arrays. Does such methods exist? Or I have to map them as equivalent 1-d arrays?

basshelal commented 1 year ago

Unfortunately, you have to map them as equivalent 1-d arrays. We only have single dimension array methods.