Hacker News new | ask | show | jobs
by stelonix 1263 days ago
There really is no "correct way" to distribute C libraries and at this point it seems you're nitpicking just to nitpick. Imgui uses the same method, no one ever complained. If you do require obj files to not be "bloated" (why?) you can always do it the C way of having separate C/H files.
2 comments

There is, just like C has been doing in its 50 years of history, header only libraries are a consequence of new generations pretending C is something like Python.
imgui distribute .c/.h files, not .h files with .c embedded in them.

What I'm criticizing is the extra step of me having to write the .c files anyway to avoid bloating the obj files, which should have been done by the library in the first place.

As others have pointed out, you don't need to write extra .c files, and you won't bloat the obj files. This paradigm is fairly common, see, e.g.:

https://github.com/lieff/minimp3

https://github.com/Immediate-Mode-UI/Nuklear

https://github.com/mattiasgustavsson/libs/blob/main/docs/htt...