#error: comptime call of extern function

1 messages · Page 1 of 1 (latest)

shell tiger
#

whats the * in front of c.glfwCreateWindow

coral nymph
#

admitting glfwCreateWindow has return type ?*GLFWwindow

const c = @cImport({
    @cInclude("GL/gl.h");
    @cInclude("GLFW/glfw3.h");
});

pub var glWindow: *c.GLFWwindow = undefined;

pub fn createWindow(windowName: []const u8, Width: i32, Height: i32) void {
    if (c.glfwInit() == 0) {
        // Handle error appropriately
        return;
    }
    glWindow = c.glfwCreateWindow(Width, Height, windowName, null, null) orelse {
        // Handle window creation error
        return;
    };
}```