Kravantokh’s C library
A minimal, portable header-only C library meant to provide a bunch of useful functionality, ideally across multiple platforms. Consider linux the default platform.
Convetions
All headers in subdirectories are not supposed to be consumed. Only headers in the repo root are meant to be used.
Usage
This repo is meant to be used as a git submodule in any project you want to use it it. The include paths are convieved so that they are reasonable if you add this repo’s include directory to the include paths of your compiler. You should include the Makefile from this project into your own Makefile, adding any additional directories you need to the C_FILES_DIRS. Do not name any of your C files starting with kc or kc_. These are reserved for the library.
Macros and Makefile options
These can all be either declared with -D for the compiler or given to the makefile via CLI or env, as usual with makefiles. In the makefile’s case set them to 1.
- KC_IMPLEMENT - actually generate the implementation from the headers and not just declare everything. This is great for unity builds or grouping different implementations into different
.cfiles. - KC_USE_PLATFORM_LIBC - use the current platform’s libc where this is an option.
- KC_ZERO_MEMORY_STRICT, KC_ZERO_MEMORY_LOOSE - zero out buffers, released memory etc. even in places where it would not be strictly necessary from a functional standpoint. Strict zeroes out the most, loose zeroes out the most critical ones and none does not zero out any places that are not strictly necessary for functionality.