Application Services' `RustBuffer` does not work with JNA Union
Categories
(Data Platform and Tools :: Glean: SDK, enhancement, P2)
Tracking
(Not tracked)
People
(Reporter: Dexter, Unassigned)
Details
When using RustBuffer as part of a structure to be passed across the FFI boundary using JNA Structure and Union, JNA throws an exception because it is unable to compute the structure size.
This is for investigating the problem to understand if we can make it work. See the original comment.
| Reporter | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 1•6 years ago
|
||
The linked comment indicates you were using RustBuffer.ByValue. I believe this is incorrect -- You should be using RustBuffer; the ByValue type is only for use inside function arguments and function return values.
That said, maybe this still doesn't work... I don't see a huge problem with the way you've done it if nested structures don't work with JNA.
| Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Thom Chiovoloni [:tcsc] (please ni?) from comment #1)
The linked comment indicates you were using
RustBuffer.ByValue. I believe this is incorrect -- You should be usingRustBuffer; the ByValue type is only for use inside function arguments and function return values.
Yup, RustBuffer (without ByValue) was the first thing we tried!
That said, maybe this still doesn't work... I don't see a huge problem with the way you've done it if nested structures don't work with JNA.
Right :-) Not a big deal, but we'd really like to re-use your stuff as much as possible ;-)
Comment 3•6 years ago
|
||
Hmm... maybe we should file a bug in JNA, then.
Comment 4•6 years ago
|
||
Indeed. I mainly wanted this bug filed so we can take another look on whether this was us misusing the JNA parts or it's a bug we can report. I'm happy to take this on.
Comment 5•6 years ago
|
||
By pure accident I stumbled upon another bug today, that led me down a path of different alignment and padding bytes.
After some adjustements (len: i64 -> len: i32) to fix our issue I was also able to bring back a RustBuffer class, see https://github.com/mozilla/glean/pull/898
| Reporter | ||
Updated•6 years ago
|
Description
•