Re:STB: Single-file public domain libraries for C/C++
by teo_zero on Sunday January 07, 2024 @09:11AM
(#38901306)
While I'm a big fan of keeping declarations and implementations as close as possible, I find that the need to explicitly #define STB_SOMETHING_IMPLEMENTATION before including the header somehow spoils the simplicity of the solution. At this point, I'd rather use a single file that acts as either a .h or a .c based on __INCLUDE_LEVEL__ (a GCC extension, not sure if available for MSC).
For instance here is the start of the implementation block in stb_image.h, above that is just "cheap" public API declarations:
https://github.com/nothings/stb/blob/f4a71b13373436a2866c5d6...