ziglibs / zgl

Zig OpenGL Wrapper
MIT License
408 stars 63 forks source link

update CallOptions to use struct format #70

Closed pyr0hu closed 1 year ago

pyr0hu commented 1 year ago

The current version uses the @call(.always_tail) format for the CallOptions. The latest Zig version - https://ziglang.org/documentation/0.10.0/#call - has a Struct for it.

The current version, when compiling a simple program, threw the following:

C:\Users\pyro\Code\game\.gyro\zgl-ziglibs-github.com-d7b06c09\pkg\binding.zig:1829:19: error: expected type 'builtin.CallOptions', found '@TypeOf(.enum_literal)'
    return @call(.always_tail, function_pointers.glClearColor, .{_red, _green, _blue, _alpha});
C:\Users\pyro\scoop\apps\zig\current\lib\std\builtin.zig:594:25: note: struct declared here
pub const CallOptions = struct {
                        ^~~~~~
referenced by:
    clearColor: C:\Users\pyro\Code\game\.gyro\zgl-ziglibs-github.com-d7b06c09\pkg\zgl.zig:217:12
    main: C:\Users\pyro\Code\game\src\main.zig:33:11
    remaining reference traces hidden; use '-freference-trace' to see all reference traces

C:\Users\pyro\Code\game\.gyro\zgl-ziglibs-github.com-d7b06c09\pkg\binding.zig:1913:19: error: expected type 'builtin.CallOptions', found '@TypeOf(.enum_literal)'
    return @call(.always_tail, function_pointers.glGetError, .{});

With the following changes, the code compiles.

ikskuh commented 1 year ago

That would be a backport from 0.11 (indev) to 0.10 (release). You need to go back to a commit that is compatible to 0.10. zgl officially does only track master

pyr0hu commented 1 year ago

Got it boss. Did not know that. These kind of information would be nice to have in the README. And I think most people installs the stable version of the compiler and it cannot be expected that they should find a compatible commit with their version. For example, if you'd have a stable branch which is in line with 0.10, that'd be nice.

If they want to use your library, they can't. While this is your repository and your rules, it just makes using this library not straightforward.