Blessed C List

Tooling

Tools you may need throughout the development process: development, building, testing, and debugging.

About Development

Use Case Recommended Tools
Standard Library glibc
The most widely used C standard library.
musl
Light-weight and efficient C standard library, designed for static linking.
uClibc-ng
Another light-weight C standard library, designed for embedded systems.
Package Manager Conan
A C/C++ package manager, with a large repository.
vcpkg
Package manager from Microsoft. Mainly for Visual Studio, but works on Un*x too.
pkg-config
A helper tool for using libraries. Not really a package manager, but widely used to help find libraries installed on a system.
Language Server clangd
Adds smart features to your editor: code completion, compile errors, go-to-definition and more.
Linting Cppcheck
A static analysis tool for common C/C++ code problems.
clang-tidy
A clang-based C/C++ linter. The default linter for clangd plugin and CLion IDE.

About Building

Use Case Recommended Tools
Toolchain GCC C Compiler
Widely used compiler for Un*x system.
Clang
A C frontend that compiles C into LLVM IR. Also very popular.
MSVC
Microsoft’s C compiler toolchain, mainly for Windows.
Build System Autotools
One of the most widely used build systems (configure && make).
CMake
The de-facto standard for building modern C/C++ project.
Note: Also check meson and SCons, which are not so popular but have their own advantages. A comparison can be found here.
Documentation Generator Doxygen
The most widely used documentation generator for C. Default theme looks not very attractive but can be customized.

About Testing

Use Case Recommended Tools
Benchmarking hyperfine
Tool for benchmarking compiled binaries (similar to unix time command but better).
Testing Criterion
Simple yet powerful unit testing framework, C99-compatible.
Unity
Another simple unit testing framework, focusing on embedded systems (8-bit to 64-bit systems supported).

About Debugging

Use Case Recommended Tools
Automatic Checker Sanitizers
AddressSanitizer, UndefinedBehaviorSanitizer, MemorySanitizer to detect runtime problems.
Valgrind
A tool suite for debugging and profiling, having similar features to sanitizers. Both are very popular and time-tested.
Manual Debugger GDB
The most widely used debugger by GNU for C, as well as Asm, D, Fortran, Go, Rust, OpenCL, and many other languages.

Common

Very common tools that every C developer should know about.

General

General use case.

Use Case Recommended Tools
Random Number libsodium
libsodium, as a modern and easy-to-use crypto library, also provides a secure random number generator.
shishua
Very fast PRNG (non-cryptographic), claimed to be faster than most implementations. Inactively maintained.
UUIDs libuuid
Generates UUIDs. Part of the e2fsprogs (i.e. ext2 filesystem tools) package. Unmaintained for a long time.
IdGenerator
Fast SnowFlake-based unique ID generator, having C port. Actively maintained but documentation is Chinese only.
Gzip (de)compression zlib
Official zlib library. Use it if you need great portability and run on old systems.
zlib-ng
A fork of zlib with many patches for modern hardware and OS. Use it if you need performance.
Logging zlog
High-performance & thread safe logging library. POSIX/Windows compatible.
syslog
GNU C library’s syslog helper functions. Available on most Un*x systems, and should be used if you are writing a OS-related tool.
HTTP Request libcurl
The most widely used client-side URL transfer library.
Resource Embedding incbin
A simple macro library to embed arbitrary files into source code.
All-In-One Utility Sometimes you may want to use a library that does many things in a uniform and portable way. Here are some of them. To keep the list brief, all features cannot be listed here.
GLib
A general-purpose utility library by GNOME. Widely used.
APR
Apache Portable Runtime, updating infrequently but stable.
gnulib
A collection of subroutines used by many GNU programs, also providing system header (e.g. unistd.h) polyfills for non-Un*x platforms (e.g. Windows).
tbox
Independent glib-like portable library, C99-compatible. Works best with xmake build system from the same author.
sc
Portable, stand-alone, single-header libraries and data structures, C99-compatible.
stb
Famous single-header libraries focusing on multimedia processing and game-dev utils.

Data Structures

Common data structures.

Also please take a look at all-in-one utility libraries in the previous section, because they often include data structure implementations.

Use Case Recommended Tools
Generic Collections Collections-C
Generic arrays, lists, hashmaps, and more. Uses void * to store any type of data.
STC
Similar to Collections-C, but uses macro definitions to simulate generics.
klib
Uses macro functions to simulate generics.

String Manipulation

Use Case Recommended Tools
Dynamic Strings sds
Simple Dynamic Strings library, forked from unmaintained sds.
Unicode Support utf8.h
Single-header UTF-8 library mimicking string.h functions.
ICU
International Components for Unicode, official Unicode toolkit. Includes String iteration, collation, datetime formatting, parsing, locale-sensitive text segmentation, and more. Much more heavier.
SIMD Acceleration StringZilla
SIMD-accelerated string fuzzy matching, edit distance, and more.
Regular Expressions (Regex) hyperscan
Intel’s high-performance multi-thread text matching library. Use a well-designed callback-style API and may be too complex for simple use cases.
cre2
C wrapper of Google’s re2 library. Easy to use but inactively maintained.
oniguruma
Standalone regular expression library. Easy to use.

(De)serialization

Use Case Recommended Tools
CSV zsv
Fast (simd) CSV parser.
JSON Note: Here is a performance benchmark of most C/C++ JSON parser.
cJSON
Two-file, ultralightweight JSON parser in C89. Suitable for embedded systems, not thread safe.
json-c
A formal, high-performance JSON parser, with multi-threaded support.
yyjson
A two-file high-performance JSON parser in C89, with SIMD acceleration, claiming to be faster than C++’s simdjson. Newer and less popular than above.
INI inih
Single header INI file parser, good for embedded systems.
YAML libyaml
Official YAML parser, but inactive for a while.
TOML tomlc99
C99-compliant TOML parser.
XML libexpat
Fast streaming XML parser, C99-compliant.
libxml2
GNOME’s XML toolkit, standards-compliant and portable, C89-compliant.
HTML lexbor
Not just a parser, but a full-featured HTML5 Renderer. It has HTML (de)serialization support, the successor of deprecated parser myhtml by the same authors.
libtidy
A traditional HTML parser and pretty printer, by W3C members back in the dawn of the WWW. Stable and widely used, but inactive for a while.
Protocol Buffer nanopb
A protobuf implementation especially designed for embedded systems.

Language Extensions

Try to add (or “simulate”) some modern language features to C.

Use Case Recommended Tools
Algebraic Data Types datatype99
Intuitive algebraic data types with exhaustive pattern matching & compile-time introspection facilities.
Object-Oriented Programming GObject
The type system and object class support, primarily for GTK. Requires GLib.
Better Macros metalang99
Provides macros with compile-time list generation, recursion, overloading features.
Checked Integer Arithmetic safe_math
Integer arithmetic with overflow checking. It is a C port of C++ library SafeInt, which is recommended by Microsoft. Inactive for a while.
Concurrency Note: This part needs discussion. The author (me) has no experience in C concurrency.
libcsp
A high-level concurrency library for C, inspired by Go. Inactive for a while.

System

Memory Management

Use Case Recommended Tools
Allocator mimalloc
Memory allocator with a focus on performance and small memory usage, from Microsoft. It claims to be faster than all the libraries below.
jemalloc
A general purpose malloc implementation that emphasizes fragmentation avoidance and scalable concurrency support, from Facebook. Widely used.
tcmalloc
Thread-Caching Malloc, from Google.
rpmalloc
Memory allocator with built-in support for thread-caching, heap-pinning and small block merging. Independent.
Garbage Collector Boehm-Demers-Weiser GC
A general purpose, garbage collecting storage allocator.

Portable System Interface

Most all-in-one utilities also focus on portability. Check them first.

Use Case Recommended Tools
General Case plibsys
Highly portable system interface for 15+ OSes and 10+ compilers. Zero-dependency.
Backtrace libunwind
Introspet the call stack of a program, both local (this process) and remote (another process). Portable among Un*x systems (NOT Windows).
libbacktrace
Similar, but supports all of GNU/Linux, *BSD, macOS and Windows, and only supports local backtrace. Less actively maintained.
Environment Probing whereami
Locate the current running executable and the current running module/library on the file system.
cpu_features
A cross platform library to get cpu features at runtime, C99-compliant.
USB Access libusb
A cross-platform library to access USB devices.

I/O & Networking

Networking is the dullest part of C programming.

Async Foundation

Use Case Recommended Tools
Async I/O libuv
Async library for TCP/UDP/DNS/IPC/Singal Handling/File operations. Primarily developed for Node.js.

Protocol Support

Use Case Recommended Tools
HTTP libmicrohttpd
A small library that makes it easy to run an HTTP server. Widely used for small projects.
mongoose
A two-file embedded TCP/UDP/SNTP/HTTP/MQTT/WebSocket server, designed for platforms from STM32 to Windows. Very popular, easy to learn and time-tested.
libhv
Full-featured async library for TCP/UDP/HTTP(S)/WebSocket client/server/proxy, and MQTT client, with a modern and easy-to-use API.
gRPC Note: Unfortunately, there is no good gRPC library for C. The best way to use gRPC in C is to use the C++ bindings.
General RPC thrift
Apache’s Thrift RPC framework, having C binding with GLib.
Git libgit2
A portable, pure C implementation of the Git core methods provided as a re-entrant linkable library.

Database

C has incredibly complete support for databases, but it’s not as easy as using other languages. Most are low-level libraries, and you have to write a lot of codes to use them.

SQL Databases

Use Case Recommended Tools
ORMs Note: Unfortunately, there is no good ORM library for C, since C is lack of generics, reflection, compile-time code generation, OOP, etc. It is recommended to use a low-level SQL library, if you really need to use C.
MySQL libmysqlclient
Official MySQL C API.
Postgres libpq
Official Postgres C API.
SQLite sqlite
Official SQLite library.
MS SQL Microsoft® ODBC Driver for SQL Server®
Official SQL driver, closed-source.
Oracle ODPI-C
Official Oracle C API.

Other Databases

Use Case Recommended Tools
Redis Hiredis
Minimalistic C client for Redis >= 1.2, officially supported.
Hiredis-cluster
for cluster deployments of the Redis database.
MongoDB libmongoc
Official MongoDB C driver.
Rocks DB rocksdb
Official RocksDB library for C/C++.
Embedded DBs EJDB
An embeddable JSON database engine.

Math / Scientific

Some all-in-one utilities also contain math and/or scientific subroutines; check them first.

Note: Mathematics and scientific computing is a very broad field. Considering that C has been one of the go-to languages for high-performance computing since its invention, there are lots of libraries in this area. We would like to include all the common use cases for an average programmer (e.g., high-precision computation, linear algebra, transformations, etc.) instead of a math researcher (you shouldn’t rely on this list if you are doing serious mathematics, should you?), and it is not possible to discuss all of them in order to keep the list short.

Use Case Recommended Tools
Big Integer GMP
The GNU arbitrary-precision arithmetic library.
Big Decimal MPFR
The GNU multiple-precision floating-point computation library with correct rounding.
Linear Algebra OpenBLAS
An optimized BLAS (Basic Linear Algebra Subprograms) library. Mainly supports CPUs.
CLBlast
BLAS with OpenCL. Supports GPUs.
clBLAS
The most famous BLAS library with OpenCL, but unmaintained for a long time.
cuBLAS
NVIDIA’s proprietary BLAS library with CUDA. Has the maximum performance on NVIDIA GPUs.
Fourier Transform FFTW
A fast Discrete Fourier transform implementation.
DataFrame Apache Arrow GLib
Official C API for Apache Arrow.
Computer Vision ccv
A modern computer vision library.
Neural Networks ggml
Tensor library for machine learning, especially for large language models.
Darknet
Fast CNN library from YOLO author. Unmaintained for a long time.

Command-Line Tool

Argument Parsing

Use Case Recommended Tools
POSIX/BSD-style (-cvf) getopt
In POSIX specification, getopt is the standard method to parse command-line arguments.
getopt_long
GNU extension of getopt that supports long options (–foo=bar) and has been widely accepted. Included in glibc and gnulib.
argparse
Standalone argument parser supporting subcommands. Inactive for a while.
cmd_arger
A nice argument parser with declarative syntax and auto-generated help message. Inactive for a while.
DOS-style (/C /V /F) getopt-dos
Like getopt, but supports DOS-style options. Immature and unmaintained.

Terminal Rendering

Use Case Recommended Tools
Progress indicators progressbar
An easy-to-use C library for displaying text progress bars. Inactive for a while.
TUI ncurses
De facto standard library for TUI. Only Un*x support.
pdcurses
A curses implementation for DOS, OS/2, Windows console, X11 and SDL.
notcurses
A newer TUI/terminal graphic library if you don’t want curses.
Interactive prompts readline
De facto standard GNU library for interactive inputs. Bash is actually built on it, which supports history, completion, and line editing features.
linenoise
A small, self-contained alternative to readline and libedit. Only Un*x support, and being inactive for a while.

Concurrency

Use Case Recommended Tools
Parallel computation libgomp
GNU’s OpenMP implementation, a set of compiler directives and library routines for parallel computation. Easy to learn and use.
Open MPI
Open source MPI implementation, used for parallel computation on distributed systems.

Cryptography

C has a solid history in cryptography, and there are many nice libraries available for cryptographic tasks. Thus popularity and maturity are the main criteria for the selection.

It is hard to classify cryptographic libraries by use cases, because most of them provide a wide range of cryptographic algorithms.

If you are looking for a specific algorithm implementation, you should check each library’s documentation to see if it supports what you want.

Use Case Recommended Tools
General Purpose Hashing libgcrypt
GnuPG’s cryptographic library. Provides general-purpose hash functions, symmetric and asymmetric encryption, and more.
trezor-crypto
Heavily optimized for embedded devices.
Password Hashing libsodium
An easy-to-use software library for encryption, decryption, signatures, password hashing, having a very modern and beginner-friendly API.
TLS/SSL OpenSSL
The de-facto standard implementation for modern cryptography. Provides a full-featured toolkit for the TLS and SSL, also with a lot of cryptographic and certificate algorithms.
Non-cryptographic Hashing xxHash
A fast non-cryptographic hash algorithm and implementation, claiming to be faster than memcpy.
highwayhash
from Google (simd), also quite fast.
Post-Quantum Cryptography liboqs
Experimental implementation of quantum-resistant cryptographic algorithms.

FFI / Interop

Embeds other languages into C. To embed C into other languages, just check the FFI documentation of the target language.

Use Case Recommended Tools
Python Python/C API
The official C API for Python.
JavaScript V8
Google’s open source high-performance JavaScript and WebAssembly engine, really fast but heavyweight.
QuickJS
A small and embeddable JavaScript engine with competitive performance.
Duktape
Even smaller and embeddable JavaScript engine (only 2 files), but less performant.
Lua LuaJIT
A Just-In-Time Compiler for Lua, with a C API.
Dart Dart Embedding API
Embed Dart into C/C++ applications. No official documentation, only community examples.
Wrapper Generator SWIG
Simplifies the task of interfacing different languages to C and C++ programs.

Graphics

Note: Currently this part is mainly finished by a contributor who never works on graphics with C. If you find anything weird, please feel free to open an issue or pull request in the GitHub repository.

High-level GUI

Use Case Recommended Tools
Declarative UI GTK
A traditional multi-platform toolkit for creating graphical user interfaces.
LCUI
Building desktop apps with XML/CSS. Modern but immature.
LVGL
Light and powerful GUI library. Mainly designed for embedded systems.
libui-ng
Fork of unmaintained libui, a simple and portable GUI library using native widgets on Unix, Windows, and macOS. Still immature.
Immediate Mode UI Nuklear
Single-header immediate mode portable GUI library, C89-compatible.
Web-based UI azul
GUI framework for desktop applications in Rust based on Mozilla’s WebRender, having C bindings.
File Dialogs tinyfiledialogs
Single-file dialog library for showing cross-platform file dialogs.
Accessibility AccessKit
UI accessibility infrastructure across desktop platforms in Rust, having C bindings.

Low-level Graphics

Use Case Recommended Tools
OpenGL GLFW
A cross-platform library for OpenGL, OpenGL ES, and Vulkan, C99-compatible.
glad
Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs. Usually used with GLFW to generate GL function pointers.
Multi-backend Rendering SDL
A cross-platform library designed to provide low-level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL, Direct3D, etc. Stable & time-tested.
raylib
for games and multimedia programming. Modern & beginner-friendly.
Text Rendering HarfBuzz
Text shaping library, with an emphasis on internationalization. Widely used in many projects and OSes.
pango
Library for laying out multi-line text correctly, depending on HarfBuzz. Can be used alone but works best with a rendering backend, e.g. Cairo or Freetype.
FreeType
Font rasterization engine, rendering font files to bitmaps. Widely used in many projects and OSes.

results matching ""

    No results matching ""