Library / SDK
tboox/tbox avatar
tboox/tbox

tbox: four build modes and a tb_ prefixed C library

🎁 A glib-like multi-platform c library

5,129 stars750 forksCApache-2.0

At a glance

What is it?
tbox gives a C project containers, streams, coroutines, regex and network code under one Apache-2.0 library, with four xmake build modes and a single naming rule. The optional backends are the part to check on its documentation site.
Who is it for?
tbox fits a C project that wants containers, iteration, streams and coroutines without pulling a general purpose runtime into the build, and it fits an embedded target through the Micro mode. It does not fit a team that wants every module documented in depth in the README itself, since the README gives most modules as short bullet lists.
Can I use it commercially?
Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 2 days ago.
What is it written in?
Mainly C, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 15, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • tboox/tbox5,129 ★ · +7
Star history
Repository2026-09-232026-11-15
tboox/tbox5.1k5.1k

7 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

The tb_ prefix and the iterator mode hold the API together

tbox is a C library that tries to give C programmers the shape of a higher level standard library. Two conventions do most of the work of keeping it coherent.

The first is naming. Where tbox stands in for a libc or libm call, the interface name carries a `tb_` prefix to avoid conflict with the system one, and the README says both the light libc surface and the light libm surface for float and double follow that rule. It extends the string interfaces (`strixxx`, `strrxxx`, `wcsixxx`, `wcsrxxx` in the file's shorthand), adds `memset_u16`, `memset_u32` and `memset_u64`, and ships optimised versions of memset, memcpy and strcpy. Because every replacement starts with the same three characters, you can tell at a glance which side of the line a symbol sits on.

The second convention is the iterator. Containers (hash table, single list, double list, vector, stack, queue, min and max heap), the algorithm library and even the database layer, which enumerates data in the iterator mode, all expose data the same way. Write the traversal once and it runs over a list, a heap and a query result.

Four xmake build modes, and Micro stops at about 64K

The build options are the part of tbox you feel first, because they decide what gets compiled in. Four are named, and each removes or adds a specific class of behaviour.

Release disables debug information, assertion and memory checking, and turns optimisation on. Debug does the opposite, enabling debug information, assertion and memory checking with optimisation off. Small disables all extensional modules and turns on space optimisation. Micro compiles a micro library of about 64K for the embed system.

The consequence for a team is that the binary you ship and the binary you test are not the same artifact. Memory checking and assertions are disabled in Release, so a defect the Debug build would report goes unreported in the shipped binary. Choose the mode per artifact, not per developer.

Two build paths: xmake and configure

xmake is the primary path, and the README asks you to install it first. Building for the host platform is two commands:

console
$ cd ./tbox
$ xmake

Cross compilation goes through `xmake f` with a platform flag, and the README shows the mingw form:

console
$ xmake f -p mingw --sdk=/home/mingwsdk

The android line expects your NDK path (`--ndk=xxxxx`), the iphoneos line takes `-p iphoneos` with no extra path, and the linux line takes `--sdk=/home/sdk`, with `--bin=/home/sdk/bin` available in a trailing comment.

A second path exists for anyone who would rather not add another build tool. The repository ships a `configure` script at the top level, next to `xmake.lua` and the `xmake/` directory:

console
$ ./configure
$ make

Since the repository's default branch is `dev`, a plain clone gives you a development snapshot rather than a release.

The memory checker only exists in the debug build

tbox has a debug mode that finds memory defects, and the list is specific: out-of-bounds accesses to heap and globals, use-after-free, double-free, invalid free, and memory leaks. The utils library adds assert and trace output for the same debug mode.

The catch is the build mode. Memory checking belongs to Debug and is switched off in Release, so the tool that finds a defect and the artifact that reaches users come from different code paths. A team whose continuous integration only ever builds Release gets none of this reporting, and the leak that would have failed a Debug test never gets the chance to fail anything.

That makes the two builds complementary rather than interchangeable: Debug to find the defect, Release to decide whether the change is acceptable.

Streams, pollers and coroutines decide your I/O model

The I/O side is where tbox is most opinionated, and it stacks three layers.

At the bottom sit sources and a poller. Streams can be backed by a file, by data, by http or by a socket, carry filters for gzip and charset, expose a static buffer stream for parsing, and transfer between each other. The platform layer supplies the poller (epoll, poll, select, kqueue, IOCP), timers in fast and low precision flavours, atomic and atomic64 operations, spinlocks, mutexes, events, semaphores, threads and a thread pool. Waiting on a pipe, a socket and a process at the same time in a coroutine and in the poller is called out explicitly.

Above that sits the coroutine library: arm, arm64, x86 and x86_64 support, stackful and stackless coroutines, channels, semaphores and locks, socket and stream operations inside a coroutine, and a few io servers including http. The platform layer also exposes switch context interfaces, which is what a coroutine implementation asks of the scheduler.

The practical consequence is that one program can run blocking or coroutine style, but the mechanism underneath depends on the platform: kqueue on macOS and the BSDs, IOCP on Windows, epoll on Linux.

Charset, zip, ssl and regex all hand off to another library

Several modules outsource the hard part, and the wording is worth reading literally.

The charset module handles utf8, utf16, gbk, gb2312, uc2 and uc4 in both big endian and little endian mode. The zip module supports gzip, zlibraw and zlib using the zlib library if it exists, and implements lzsw, lz77 and rlc algorithms. The network module implements ssl through openssl, polarssl or mbedtls, with dns caching, cookies and both ip versions alongside it. The regex module uses pcre, pcre2 and posix regex modules, and supports match and replace in global, multiline and caseless modes.

The gap is selection. The ssl module can use three libraries and the zip module uses zlib if it exists. If your build has to use one specific TLS library, settle that question on the documentation site before you commit to the dependency.

Compared with glib: same shape, one naming rule, four modes

The project's own description calls tbox glib-like, and that is the honest way to size it. The approach matches: a container set, algorithms that iterate over them, string handling, and a single entry point that initialises the runtime before main work starts.

The differences are concrete. tbox prefixes its libc and libm replacements with `tb_`, so they sit beside the system calls rather than replacing them. It also ships four xmake build modes, including a micro library of about 64K for the embed system, where a general purpose runtime is out of the question. And its I/O stack includes coroutines, channels and an http io server as part of the library rather than as an extension.

Where the README is thin is depth. Every module arrives as a short bullet list, so for the parts you depend on you are reading headers and the documentation site rather than a manual written alongside the feature.

Apache-2.0 with a NOTICE file, and dev as the default branch

The licence is Apache-2.0, and the tree carries `LICENSE.md` and `NOTICE.md` at the top level next to `CHANGELOG.md`, `CONTRIBUTING.md` and `CODE_OF_CONDUCT.md`. The README's licence badge links to the file on the master branch while the repository's default branch is `dev`, which only matters when you are chasing a particular commit.

Release history is regular enough to plan around: v1.8.0 on 2026-02-10, v1.8.1 on 2026-07-05 and v1.8.2 on 2026-08-03, with the last push on 2026-10-26. Pin a tag rather than following the default branch, because the branch carries work in progress that the numbered releases do not.

Support runs through a sponsor page, a donation link, a subreddit, a gitter room and a telegram channel. The README also names projects built on tbox, including gbox, vm86, xmake and itrace, which is the part of it you can go and check.

Editorial conclusion

tbox fits a C project that wants containers, iteration, streams and coroutines without pulling a general purpose runtime into the build, and it fits an embedded target through the Micro mode. It does not fit a team that wants every module documented in depth in the README itself, since the README gives most modules as short bullet lists. Before adopting it, check the documentation site for how the ssl and regex backends are selected, then pin a release tag instead of following the dev branch.

Frequently asked questions

How do I build tbox from source?

The README asks you to install xmake first, then build for the host platform with `cd ./tbox` followed by `xmake`. A second path uses the `configure` script in the repository root with `./configure` and then `make`.

What changes between the tbox Release, Debug, Small and Micro builds?

Release disables debug information, assertion and memory checking and enables optimization, while Debug enables those three and disables optimization. Small disables all extensional modules and optimizes for space, and Micro compiles a micro library of about 64K for the embed system.

Which platforms does tbox support?

The README names Windows, Macosx, Linux, Android, iOS and *BSD, and its build section gives commands for the host platform plus mingw, iphoneos, android and linux targets.

Does tbox replace the libc functions I already link against?

The libc and libm modules implement light interfaces whose names carry a `tb_` prefix to avoid conflict, extending the string interfaces and adding `memset_u16`, `memset_u32` and `memset_u64` next to optimised versions of memset, memcpy and strcpy.

Official sources

  1. License: Apache-2.0
  2. Project website
  3. README
  4. Releases
  5. tboox/tbox on GitHub
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/tboox-tbox.svg)](https://hysenlabs.com/projects/tboox-tbox)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/tboox-tbox.svg)](https://hysenlabs.com/projects/tboox-tbox)

Was this useful?