Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> they're nontrivial to bind to from non-C languages

This particular library doesn't seem to follow the STB convention where the implementation is inside an #ifdef IMPLEMENTATION block, but that would be trivial to fix.

Once you have that it's just as trivial to use from other languages as a regular .h/.c library, just include the implementation into a C source file and compile that into a static link library or DLL, then include the declarations (without IMPLEMENTATION define) into your language (if the language can directly include C headers) or use the header to auto-generate the bindings.

For example:

- https://github.com/floooh/sokol-zig

- https://github.com/floooh/sokol-nim

- https://github.com/floooh/sokol-odin

These are all auto-generated from STB-style single-file libraries: https://github.com/floooh/sokol



Oh yeah that'd do it. Good point.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: