Skip to content
single header libraries for C/C++
C C++ Python
Branch: master
Clone or download
vurtun Merge pull request #25 from ElementW/master
Fix lexer_read_on_line returning empty tokens at EOF
Latest commit 1569895 Jan 17, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
tests [json] Reordered token struct to reduce in memory size Nov 17, 2018 Fix headers not displaying properly on GitHub Mar 25, 2018
json.h [json] fixed example in comments Nov 30, 2018
lexer.h Fix lexer_read_on_line returning empty tokens at EOF Apr 19, 2019
sched.h msvc fixes (see comment) Mar 8, 2019
web.h Fix address overflow issue in web.h for 64 builds. Jan 17, 2020


My single header libraries for C/C++.

library lastest version category LoC license description
lexer.h 1.00 parser 1155 zlib simple lexer for C-like languages
json.h 1.00 parser 848 zlib non-allocating json parser
sched.h 1.00 multithreading 699 zlib multithreaded task scheduler
vec.h 0.02 math 2240 zlib vector math
web.h 1.00 network 1455 BSD lightweight webserver

Total libraries: 5
Total lines of C code: 5608


Why single-file headers?

Windows doesn't have standard directories where libraries live. That makes deploying libraries in Windows a lot more painful than open source developers on Unix-derivates generally realize. (It also makes library dependencies a lot worse in Windows.)

There's also a common problem in Windows where a library was built against a different version of the runtime library, which causes link conflicts and confusion. Shipping the libs as headers means you normally just compile them straight into your project without making libraries, thus sidestepping that problem.

Making them a single file makes it very easy to just drop them into a project that needs them. (Of course you can still put them in a proper shared library tree if you want.)

Why not two files, one a header and one an implementation? The difference between 10 files and 9 files is not a big deal, but the difference between 2 files and 1 file is a big deal. You don't need to zip or tar the files up, you don't have to remember to attach two files, etc.

Where is the documentation?

Each file has documentation, basic ussage description and examples at the top of the file. In addition each API function, struct and member variables are documented as well. Finally each library has a corresponding test file inside the test directory for additional working examples.

Why C?

Personally I primarily use C instead of C++ and since I want to support both C and C++ and C++ is not useable from C I therefore focus on C.

Why C89?

I use C89 instead of C99/C11 for its portability between different compilers and accessiblity for other languages.


You can’t perform that action at this time.