sokol-zig icon indicating copy to clipboard operation
sokol-zig copied to clipboard

Reminder: Stage2 compiler and new function pointer syntax.

Open floooh opened this issue 3 years ago • 1 comments

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 stage2 compiler, the triangle sample just renders a blank screen
  • more complex samples (e.g. the cube sample) just crash the compiler
  • the clear sample works 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.

floooh avatar Jul 11 '22 13:07 floooh

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

kcbanner avatar Aug 28 '22 00:08 kcbanner

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 :)

floooh avatar Oct 16 '22 18:10 floooh