Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3xau1o opened this issue Jan 24, 2025 · 1 comment
Open

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

3xau1o opened this issue Jan 24, 2025 · 1 comment

Comments

@3xau1o
Copy link

3xau1o commented Jan 24, 2025

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
    );
}
@3xau1o 3xau1o changed the title SDL 3: Failed to resolve compile time values for SDL_UINT64_C SDL 3: Failed to resolve compile time constants for SDL_UINT64_C Jan 24, 2025
@ojeda
Copy link
Contributor

ojeda commented Jan 25, 2025

This seems a duplicate of #753.

Could you please try the --clang-macro-fallback option?

Thanks!

Cc @jbaublitz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants