Elektrine lite

← Feed

@rivten@hachyderm.io

2026-03-27 11:04 UTC

@sschoener@mastodon.gamedev.place I really love single-header C libraries, and maybe you know this already, but you also can compile them as a separate compilation unit alreay if you do something like `gcc -x c -c my_lib.h -DMY_LIB_IMPLEMENTATION -o mylib.o`. So you can get the compilation unit part, but that’s in case you meant this specifically when you mentioned that C "suffers" from them. Also, a pattern that I really enjoy from those libs is that there is usually a large comment at the start of the file, which takes place of the doc basically. Still, having a tool to extract those info and display them as you wish is valuable :) thanks for the article !

Replies (1)

  • @rivten@hachyderm.io Thanks. Yes, I usually end up compiling the single header libraries separately. I understand why single header files make the tradeoffs they make, but I only like them -- I don't love them in the way you can love a header that just contains a few very simple declarations, and that's it :)

    Open ##4570023