-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DrawTextureRec failing silently in Release builds #9
Comments
You are right, this is a zig C ABI problem. I can't really reproduce your situation as for me the code you sent doesn't draw at all, which is somewhat expected. Zig doesn't yet support passing structures between Zig and C, including both as arguments and in return values. These kinds of issues have partly been addressed in the Readme under Technical Restrictions and the workaround branch. The exact behaviour you want to achieve should be possible on that branch, but any raylib functions returning structs wont work. Speaking of the workaround branch I'm currently trying to fix the projectSetup.sh over there and add a lib.zig similar to the one on the master branch. EDIT: My bad, I just realised your source requires a |
Shuould work now since 88c9614. Reopen if your issue persists. |
This issue gets weirder and weirder, the more I investigate. Both the draw functions work for me even on master. I do use |
I can confirm the workaround fixes the problem which is great! Thanks for investigating this. Not sure if you saw, but both draw functions work for me but only in debug builds. If I switch over to any of the 3 release modes the one with the embedded function fails. It's definitely weird. |
This is likely a zig C ABI problem.. but I'm throwing it here first because I'm worried if I post it to ziglang they will say its the library or wrapper at fault. This had me stumped for several hours! It is critical that you test this on any of the release builds, as it works fine in debug. I am using
zig build -Drelease-small=true
. I'm also running zig version0.7.0+58241364c
So this is the absolute bare minimum code to show the problem. Basically if you call a function that returns a rectangle from inside a struct and pass it to DrawTextureRec it fails silently. I am way too dumb to try and diagnose what's happening here.
Some additional info that had me really scratching my head - If you do a print command inside the problematic function to check the contents of the rectangle, it works again.
Its some schrodinger's cat behavior, works only when observed.
The text was updated successfully, but these errors were encountered: