Cosmopolitan Libc makes C a build-once run-anywhere language, like Java, except it doesn't need an interpreter or virtual machine. Instead, it reconfigures stock GCC and Clang to output a POSIX-approved polyglot format that runs natively on Linux + Mac + Windows + FreeBSD + OpenBSD + NetBSD + BIOS with the best possible performance and the tiniest footprint imaginable. For further details, read Cosmopolitan Third Edition, the Cosmo README, and the Cosmopolitan Toolchain README.
This v3.2.4 release of Cosmopolitan introduces C++ exceptions and RTTI,
which can be enabled by passing the -fexceptions
and/or -rtti
flags
to your cosmocc
compiler.
- b580080 tool/cosmocc: Allow exceptions and rtti (#1074)
- b056634 third_party/libcxxabi: Add test suite (#1076)
- b090966 third_party: Add libunwind (#1053)
- 81ce2e4 Call thread finalizers on exit()
- 94bab16 Add fixes to libunwind (#1069)
- 8b33204 Add LLVM libcxxabi (#1063)
- 6ab0171 Fix aarch64 setjmp abi
If C is your preferred language, then you can use Cosmopolitan garbage
collection via our new gc()
macro. To enable this feature, you need to
pass the -mcosmo
flag to cosmocc. For example, to say gc(malloc(32))
means that memory will be reclaimed when your function returns, and it
will be reclaimed by pthread_exit()
too. There's also defer() which is
generalized and allows any callback. Pointers exist on a shadow stack.
- a4b4551 Bring back
gc()
function
Here's some additional developments since the last release:
- df648fb Revert apeinstall.sh binfmt flags (#1072)
- cafea9a Flesh out tool/zsh/mkofs
- 6cb0354 mkofs improvements
- 1609980 zsh mkofs tool
Known Issues
- Compiling the mono repo on Windows is currently broken due to #1010. In the meantime, use cosmopolitan-3.2.tar.gz