ikskuh / zig-opengl

OpenGL binding generator based on the opengl registry
European Union Public License 1.2
103 stars 16 forks source link

Changes to function pointers for self-hosted Zig #7

Closed mohamedmoussa89 closed 2 years ago

mohamedmoussa89 commented 2 years ago

Please see https://github.com/ziglang/zig/wiki/Self-Hosted-Compiler-Upgrade-Guide#function-pointers

In summary function pointers change from fn (...) to *const fn()

const function_pointers = struct {
    var glTexStorage2D: ?*const function_signatures.glTexStorage2D = null;

In the load function I've also switched to @TypeOf although this is not critical

if(get_proc_address(load_ctx, "glTexStorage2D")) |proc| {
        function_pointers.glTexStorage2D = @ptrCast(@TypeOf(function_pointers.glTexStorage2D),  proc);

I have tested this by generating and using bindings for 4.6.