32 bit windows does not compile #1188

Open
opened 2024-04-01 00:42:30 +00:00 by bluesillybeard · 0 comments
bluesillybeard commented 2024-04-01 00:42:30 +00:00 (Migrated from github.com)

I am working on an application that will support 32 bit windows.

It fails to compile due to the calling convention of OpenGL functions changing. The workaround is simple though, in my application I can call the plain GLFW function:

    fn loadProc(context: void, function: [:0]const u8) ?gl.FunctionPointer {
        _ = context;
        // If we are on windows x86 32 bit, OpenGL functions use stdcall for some reason.
        // As such, we have to handle that case.
        if(builtin.os.tag == .windows and builtin.cpu.arch == .x86){
            // get the extern function
            const glfwc = struct {
                extern fn glfwGetProcAddress([*c]const u8) *anyopaque;
            };
            return @ptrCast(glfwc.glfwGetProcAddress(function.ptr));
        }
        return @ptrCast(glfw.getProcAddress(function));
    }

Once it is compiled, when run through wine it has an access violation. That seems to be a problem with wine, as the app works fine in regular Windows. (It fails to make a window due to it running in a virtual machine, but GLFW itself initializes just fine)

I am working on an application that will support 32 bit windows. It fails to compile due to the calling convention of OpenGL functions changing. The workaround is simple though, in my application I can call the plain GLFW function: ``` fn loadProc(context: void, function: [:0]const u8) ?gl.FunctionPointer { _ = context; // If we are on windows x86 32 bit, OpenGL functions use stdcall for some reason. // As such, we have to handle that case. if(builtin.os.tag == .windows and builtin.cpu.arch == .x86){ // get the extern function const glfwc = struct { extern fn glfwGetProcAddress([*c]const u8) *anyopaque; }; return @ptrCast(glfwc.glfwGetProcAddress(function.ptr)); } return @ptrCast(glfw.getProcAddress(function)); } ``` Once it is compiled, when run through wine it has an access violation. That seems to be a problem with wine, as the app works fine in regular Windows. (It fails to make a window due to it running in a virtual machine, but GLFW itself initializes just fine)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach#1188
No description provided.