When you need to build the windows lib from source...

So the release notes say that the Windows SDL library provided should be just about bulletproof and any compiler should be able to use it, well … hold my beer!

Ok, this is a bit of a bizarre setup, but bear with me… I wanted to see if using Objective-C would work across platforms (spoiler: it does!) because then I get the loveliness of ARC and blocks and the Foundation framework, coupled with the loveliness of SDL3 :slight_smile:

So to get ObjC up and running on Windows in Visual Studio you need to use clang-cl from Microsoft, and it turns out that using clang to compile the ObjC main.m file, and linking against the standard .lib/.dll caused a segmentation violation as soon as the renderer tried to present. I was testing with the ‘clear’ app which seemed to be the simplest renderer one.

Just recompiling SDL3 with the Visual Studio project that comes with the source, but specifying the platform toolchain to be clang-cl solved the problem, and I have a colour-cycling window in my VM right now, and at the same time called NSLog() from the SDL_AppInit() callback

    NSString *test = [NSString stringWithUTF8String:"hi there"];
    NSLog(@"test: %@", test);

(A little awkward in presentation, but there’s a bug in the linker which means you actually have to call an ObjC method or linking will fail) - anyway that produced:

2024-12-11 21:09:06.147 SDLtest[10688:1876] test: hi there

So, so far, so good. More tests to come, and if your setup doesn’t work straight away on Windows, maybe compile from source :slight_smile:

1 Like

LOL Objective-C on Windows, that’s incredible. So tempted to try this.