Skip to content

SDL 3: Failed to resolve compile time constants for SDL_UINT64_C #3098

Closed
@3xau1o

Description

@3xau1o

SDL 3 has window comptime constants wrapped by SDL_UINT64_C, these are important but ignored by rust-bindgen

Source

#define SDL_WINDOW_FULLSCREEN           SDL_UINT64_C(0x0000000000000001)  
#define SDL_WINDOW_OPENGL               SDL_UINT64_C(0x0000000000000002)  
#define SDL_WINDOW_OCCLUDED             SDL_UINT64_C(0x0000000000000004) 
// many more

Expected rust binding

pub const SDL_WINDOW_FULLSCREEN: u64  = 0x0000000000000001;
pub const SDL_WINDOW_OPENGL: u64  =  0x0000000000000002;
pub const SDL_WINDOW_OCCLUDED: u64  =   0x0000000000000004; 

Zig is perfectly able to resolve these

const sdl = @cImport({
    @cInclude("SDL3/SDL.h");
});


pub fn main() !void {
    _ = sdl.SDL_Init(sdl.SDL_INIT_VIDEO | sdl.SDL_INIT_EVENTS;);

     const window = sdl.SDL_CreateWindow(
         "zig_sdl",
        640,
        480,
        sdl.SDL_WINDOW_RESIZABLE | sdl.SDL_WINDOW_VULKAN
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions