An alternative runtime for C11/C23 (mirror)
Go to file
flysand7 344d9f0398 Fix files not being removed from the pool upon closing 2023-07-31 04:19:05 +11:00
.github/workflows Maybe finally fix Github CI issues 2023-07-28 23:16:35 +11:00
include Add memory pool to cia-mem, use it for FILE 2023-07-31 04:17:57 +11:00
src Fix files not being removed from the pool upon closing 2023-07-31 04:19:05 +11:00
tests Make it compile on windows 2023-07-28 19:53:06 +11:00
utf8 ANEW 2023-07-23 01:30:04 +11:00
.gitignore Rewrite build script in python, use JSON5 for configuration 2023-07-27 09:17:57 +11:00
build.py Fix linux build failing 2023-07-28 22:41:53 +11:00
license ANEW 2023-07-23 01:30:04 +11:00
readme.md Update readme 2023-07-29 00:50:04 +11:00
todo.md add todo list 2023-07-30 21:12:52 +11:00

readme.md

Ciabatta

Linux Windows

Ciabatta - An implementation of cross-platform C standard library with the following goals:

  • Providing C standard library that fully implements all C features. Some standard libraries lack many features of C11 and C23, like threads.h or aligned_alloc in case of MSVCRT.
  • Making standard library that is easy to port to other platforms, for example an embedded platform or a custom operating system.
  • Allowing applications to debug and step into standard library functions (Hello MSVCRT!)
  • Reasonably fast CRT compared to MSVCRT and glibc, e.g. making malloc use a faster allocator, avoid runtime checks where possible, heavely rely on inlining.
  • Extend the possibilities of C standard library with commonly used functionality: implementing POSIX standard, capability for unicode processing, API to traverse directories, hash functions, better strings API, crash handlers.

Ciabatta is not binary-compatible with other CRT libraries. That means that any libraries that your project uses have to also be compiled with Ciabatta, otherwise you will run into issues.

Please note that as of today ciabatta is still during development and does not implement many of the features that need to be implemented. Using it at current time is discouraged.

Support

Operating System:

  • Windows
  • Linux

Processor Architecture:

  • x86-64

This library is supposed to be extensible to other platforms, meaning that you can write an OS layer for another OS and use the rest of the CRT functionality.

Building ciabatta

Before proceeding please note that ciabatta can only be compiled and used with clang and cuik. It may be able to work with gcc with some minor adjustments but I didn't test.

You can get cuik in the GitHub repository

For executing the script you will need at least python 3.3 and the pyjson5 package

$ pip install pyjson5

Building

On linux you can simply run ./build.lua script. On windows you have to run it like lua build.lua. Reference for command-line options:

Usage: build.py [-h] [--clean] [--test TEST]
                [--mode {debug,release}] [--target TARGET]
                [--compiler {clang,cuik}] [--cflags [CFLAGS ...]]
Options:
  -h, --help                  show this help message and exit
  --clean                     Remove all object files and binaries
  --test TEST                 Compile ciabatta executable with given file
  --mode, -m {debug,release}  Select build configuration
  --target, -t TARGET         Select target OS (default=host)
  --compiler, -c {clang,cuik} Select compiler
  --cflags [CFLAGS ...]       Pass additional compiler flags

Usage

Grab the following files into your project's (or any other) directory:

  • The ./include folder
  • The .lib folder
  • (Windows only) The utf8 folder

In order to compile your project with ciabatta see the following sections

Compiling with ciabatta on windows

  1. Add the following flags to your compilation command: -nostdlib -D _CIA_OS_WINDOWS -I /include utf8.obj -mfma
  2. Add the following sources to the compile command: ./lib/ciabatta.lib ./lib/cia.lib ./lib/crt.lib

Note: The include folder refers to the folder you copied from ciabatta. Set the path to it accordingly.

Compiling with ciabatta on linux

  1. Add the following flags to your compilation command:
    • -nostdlib -D _CIA_OS_LINUX -I ./include -mfma
  2. Link to the following libraries
    • ./lib/ciabatta.a

Contributing

Pull requests welcome and accepted in any form.

License

See the license file