ffmbindings manual bindings to C++
Jorn Vernee
jorn.vernee at oracle.com
Thu Feb 27 15:58:35 UTC 2025
Hello,
I had a quick look, and just want to note about the difference between
the result of `sizeof` and `MemoryLayout::byteSize`. From what I've
seen, compilers typically pad out the end of a struct so that it can be
aligned when placed in an array, and this can be observed when using
PAHole, or the MSVC debugging flags. i.e. this seems to be more than
just a quirk of the sizeof operator. If you want the same result using
the layout API, you have to add this trailing padding:
MemoryLayout.structLayout(
ValueLayout.JAVA_DOUBLE.withName("d1_"),
ValueLayout.JAVA_DOUBLE.withName("d2_"),
ValueLayout.JAVA_INT.withName("type_"),
MemoryLayout.paddingLayout(4));
Jorn
On 26-2-2025 03:13, Lain Lain wrote:
> Hi,
> We would like to present you ffmbindings project which helps to do
> manual bindings to C++ libraries from Java using FFM.
> Currently it contains bindings to eigen C++ library but we are going
> to publish few more this month.
> Source code: https://bitbucket.org/ffmbindings
> Documentation: https://ffmbindings.onrender.com
> Any feedback are welcome.
> Thank you,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/jextract-dev/attachments/20250227/86012fd7/attachment.htm>
More information about the jextract-dev
mailing list