dasSDL3: Idiomatic SDL3 bindings for daslang Developer GaijinEntertainment released dasSDL3, a set of idiomatic SDL3 bindings for the daslang programming language, generated with the dasClangBind tool and layered with an sdl_boost helper library. The bindings cover all of SDL3's functionality across several platforms, including its abstraction over modern GPU APIs such as DirectX, Metal, OpenGL, and Vulkan, and add daslang-specific idioms including the |> pipeline operator, builder-style object construction, and named initialization. The interface design was modeled on the Rust SDL3 bindings. This is an AI-assisted English translation of the original post: dasSDL3 Russian original https://spiiin.github.io/blog/3531085095/ . I made SDL https://www.libsdl.org/ bindings for daslang https://daslang.io/ . SDL3 sdl3 SDL abstracts access to hardware and operating system facilities. Version 3 also introduced an abstraction over modern GPU APIs https://wiki.libsdl.org/SDL3/CategoryGPU . You can still use SDL just to create a window and draw into it through another graphics API: DirectX, Metal, OpenGL, or Vulkan. There are also several companion libraries https://wiki.libsdl.org/SDL3/Libraries that extend SDL with image loading, higher-level audio and networking APIs, and simple 2D graphics. I wanted this kind of Swiss Army knife for daslang , so I used AI to build bindings for all of SDL3’s functionality across several platforms. Automatic binding generation automatic-binding-generation The bindings are generated with dasClangBind https://github.com/GaijinEntertainment/daScript/tree/master/modules/dasClangBind , which works with a subset of C++. It parses the library’s code and generates basic bindings. These still need some polishing: removing helper macros and functions that do not belong in the bindings, and adapting idioms that do not translate well between languages, such as raw pointers and objects with different lifetimes or memory management rules. Getting working bindings is the first and easiest part of the job. Idiomatic APIs idiomatic-apis The next layer is sdl boost , a set of helpers on top of the basic bindings that makes the library easier to use and the code more expressive. Every language has its own idioms. Good bindings let you use library functions in forms that feel natural in the target language. The syntax macros in daslang are a great fit for this. I used the Rust SDL3 bindings https://docs.rs/sdl3/latest/sdl3/index.html as a reference when designing the interface. I have already written about the Rust community’s approach to API design: Elegant APIs in Rust https://spiiin.github.io/blog/3198586047/ . Here I adapted those ideas to daslang . Pipelines pipelines Pipelines are one of the features that make an interface convenient to use. See Pipelining might be my favorite programming language feature https://herecomesthemoon.net/2025/04/pipelining/ . In daslang , the | operator makes value | function argument equivalent to function value, argument . The result of one call becomes the first argument of the next, so the code reads in execution order. Builder builder You can build up an object description step by step. For example, set a window’s size, add a flag, and choose its position: window options creates a WindowOptions , and each subsequent call returns an updated description. The window does not exist yet: you can prepare the settings separately and then pass them to with window . Similar chains are available for textures, shaders, samplers, and graphics pipelines. For example, here is a sampler description with linear filtering, interpolation between mip levels, and texture wrapping: filters sets the minification and magnification filters, mipmap mode controls filtering between mip levels, and address modes determines how coordinates outside the texture are handled. The result is an ordinary SDL GPUSamplerCreateInfo , which you can pass to with gpu sampler device, sampler settings to create a GPU resource with a defined lifetime. These are ordinary free functions. You do not need to turn the description into a class with methods to get a chain of calls. The parentheses around the multiline expression allow continuation lines starting with | . Named initialization named-initialization For short descriptions, it is convenient to specify the fields directly: A builder is useful when you assemble a description step by step; named initialization is useful when all the settings are known up front. Return values and Result return-values-and-result In C APIs, results are often written to parameters passed by pointer. The helper layer can return them as ordinary values. For example, window size window returns a Result