Re: Preliminary libffi progress
- Posted by jmduro Sep 30, 2022
- 1272 views
Alright, I did some testing using 32-bit Euphoria 4.1 and Raylib. I think the problem might be that libffi isn't setting the return value memory to NULL before making the call, and since I told it C_BOOL was an unsigned int (4-bytes) it was returning the garbage in the upper three bytes of the value, so I'd see something like 0x43542100 come back for "false" which Euphoria rightfully treated as non-zero "true" so the the while loop exited right away. I changed C_BOOL to char value (one byte) instead and that seems to have helped. I also fixed the incorrect ifdef for x86 detection and added a couple more examples that utilize various structure-by-value functions.
In the Windows SDK, BOOL is one byte long, I don't know why, while in Euphoria C_BOOL is four bytes long.
Jean-Marc