Subject: | libffi bundled with strawberry 64bit doesn't support returning structures |
libffi that comes with Strawberry doesn't seem to correctly support returning structs. This hasn't been a problem until now because FFI::Raw doesn't attempt to support thenm, and until now Platypus didn't either.
This is a short C program that demonstrates the problem:
https://github.com/Perl5-FFI/FFI-Platypus/blob/a9c458847dc919514e9e8a5ce01033574aaebf3f/inc/probe/recordvalue.c
(just changed dlmain to main and you should be able to build it as an exe).
The first release candidate for 3.3 does work for me at least:
https://github.com/libffi/libffi/releases/tag/v3.3-rc0
Not sure how much effort it would be to upgrade, but it might be worth using that version instead if possible. It's an RC, but it doesn't seem like they are going to release a non RC 3.3 anytime soon, and I think on windows at least it is fairly stable. I think at least some of the linux vendors are using versions out of git since there hasn't been an official release in years. I have some experience getting libffi to build on windows and can help out if there are challenges.
I am adding a check in the build code that will still work with less capability with the buggy libffi. Windows is the only platform where I see this problem (the same versions of libffi work fine in linux etc). The RC also gives you support for long double and complex types (I suspect the same bug is the cause).