1 ## libderp, yet another C collection library
5 * builds with any variant of make, any C99 compiler
6 * a proper library that you can link against
7 * no abuse of translation units, no weird macros
8 * includes proper man pages (TODO)
9 * shared and static library
10 * pkg-config interface
11 * developer friendly ISC license
13 Why you might avoid it
15 * containers use void pointers, e.g. no vector of ints
16 * pedestrian algorithms, not cutting edge
17 * hard-coded to use malloc/free
18 * not (yet) thread safe
22 Compile and install the library:
25 # detect proper way to generate shared library
28 # create static and shared libs in build/release
31 # create versioned directory for headers and libs
32 # (if path is omitted, it tries /opt and /usr/local in that order)
36 The result will be a new folder and symbolic link like this:
39 /path/libderp.x -> /path/libderp.x.y.z
47 │ ├── libderp.so (or dylib or dll)
57 Multiple versionf of libderp may be installed at once on the system in their
58 own dedicated folders. This allows everything to be versioned, including
59 headers and man pages.
61 When linking to libderp, set an rpath inside your binary to point to the
62 library of the appropriate major version. The easiest way is to use pkg-config
63 which will provide you the correct compiler/linker flags.
66 # make desired libderp version visible to pkg-config
67 export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/path/libderp.x/lib/pkgconfig"
69 # compile foo.c and link with libderp
70 cc `pkg-config --cflags --libs-only-L --libs-only-other libderp` \
71 -o foo foo.c `pkg-config --libs-only-l libderp`
74 The `--libs-only-other` options set the rpath for the resulting binary.
76 ### Libderp development
78 To build in `build/dev` with warnings, profiling, debugging information, and
79 code coverage data, use the "dev" variant:
82 # requires clang specifically
86 Object files for the dev and release variants can coexist. There is no `make
87 clean` target because there shouldn't be a need to do that manually. The
88 Makefile has an accurate dependency graph, so running `make` should always know
94 make VARIANT=dev tests
99 On platforms where Clang supports memory leak checks, you can activate them
103 ASAN_OPTIONS=detect_leaks=1 ./build/dev/test/run
106 To see test coverage for a data structure, run the cov script:
109 ./build/dev/test/cov hashmap