floooh / sokol-zig

Zig bindings for the sokol headers (https://github.com/floooh/sokol)
zlib License
355 stars 49 forks source link

Reminder: Stage2 compiler and new function pointer syntax. #24

Closed floooh closed 1 year ago

floooh commented 2 years ago

See here: https://github.com/ziglang/zig/issues/89#issuecomment-1180324510

Changing the bindings manually for the new syntax triggers problems further down though:

In the stage1 compiler, the code compiles with the new function pointer syntax, but then crashes when calling a callback out of the C code. ...this is because stage one interprets the new function point syntax as a function-pointer-pointer.

...all this only tested on an M1 Mac so far.

kcbanner commented 2 years ago

I made a PR with changes to support the new fn pointer syntax as well as the broken examples (it was a problem with asRange copying the input to the stack, then taking it's address)
here: https://github.com/floooh/sokol/pull/710 and https://github.com/floooh/sokol-zig/pull/26

floooh commented 1 year ago

Ok, it's not in the master branch yet (instead everything is in zig-0.10.0 branches), but I'll close this as fixed :)