Sokol now has official D bindings

Matheus Catarino matheus-catarino at hotmail.com
Fri Jun 6 17:35:33 UTC 2025


https://forum.dlang.org/post/ycnmacxanggaisrogkkj@forum.dlang.org

On Tuesday, 14 May 2024 at 12:35:47 UTC, ryuukk_ wrote:
> I just saw this yesterday, and i haven't see anybody talk about 
> it here, so i decided to share this great news for D here
>
> Sokol is a popular gamedev library 
> https://github.com/floooh/sokol
>
> It now officially supports D, thanks to the work led by 
> https://github.com/kassane
>
> https://github.com/floooh/sokol/blob/master/CHANGELOG.md#13-may-2024
>
> https://twitter.com/FlohOfWoe/status/1790043272385114421

Thanks for mentioning the project and Sokol's official support 
for Sokol-D.

Before (v0.1.0->v0.2.1), it was simply an experiment for testing 
cross-compilation involving two LLVM-based toolchains, and it 
wasn't really usable.
Now that Zig has been removed from version v0.3.0 to v1.0 [TODO], 
there is full support for the D toolkit [dmd/ldc2/gdc], which is 
only preferential to ldc2 for WASM targets.

**dmd-frontend** requires at least **version 2.111.0** because of 
*cimgui* (via **importC** with `@nogc`, `nothrow`, `pure`). The 
`ig` prefix can be omitted when using the imgui-wrapper (D 
mangled), making it optional.

However, due to the extensive use of C macros, sokol bindings 
aren't auto-generated from **importC**. In 
[floooh/sokol](https://github.com/floooh/sokol) main repository, 
the `clang-ast -dump` command in the Python3 script is used to 
automatically generate bindings, which updates the sokol-d files.

script generator (updated): 
https://github.com/floooh/sokol/blob/69e43214d07993b5c33e3837cf3fcfd7479f1e93/bindgen/gen_d.py

D binding project:
https://github.com/kassane/sokol-d | https://sokol-d.dub.pm


More information about the Digitalmars-d-announce mailing list