SDL (noob)

I decided I have to do some SDL stuff, instead of digging into the windows API.
This is step zero for me… Never did anything with the plethora of graphics / sound etc. possibilities.
What I do not want is a build.zig of 2000 lines with SDL stuff.

So the (for me) cleanest and easiest way is maybe what I saw here:
here
(The code on github in the description of the video).

The only riddle I stumbled upon was this:

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

Where or where is the location of this? What is the magic behind it?

The magic behind it is that it has been deprecated in 0.16.0. That link should explain the details and alternatives.

edit: also note that in 0.17.0 translate-c has entirely moved out so must be pulled in as a dependency.

2 Likes

The magic behind it is the same as C include: The zig compiler will search in the include paths for the header. If these are headers are installed in known locations, it will find them and link them up.

Like @pasta said, it is going away. So you will have to use translate-c in the future. And that will remove some of the magic.

Thx! Struggling on from here :slight_smile: