everymen
JCHJava Community | Help. Code. Learn.
•Created by everymen on 2/23/2025 in #java-help
How to describe nested struct layout through jdk 22 ffm APIs?
Based on the example like [1]. I am able to access C compatible function. With following code, I am also able to access my custom Rust lib.
However, I have a problem describing complicated nested struct type. For instance, I have a custom struct MyStruct, which embeds a rustc_hash.FxHashMap, which in turns embeds a hashbrown.HashMap, which again contains 2 fields - one generic type S (a DefaultHashBuilder), and a RawTable, which contains a non public struct TableInner.
In this case,
1. should I construct RawTable and all corresponded data struct such as TableInner, and so on before creating my custom structLayout i.e. MyStruct?
2. if yes, how to create structLayout that represents generic type e.g. S?
Many thanks.
[1]. https://belief-driven-design.com/looking-at-java-22-foreign-function-memory-api-57fde/
[1]. https://belief-driven-design.com/looking-at-java-22-foreign-function-memory-api-57fde/
10 replies