CJIT: C, Just in Time

· coding · Source ↗

TLDR

  • Single-file C compiler and interpreter under 2MB, built on TinyCC, executes C scripts instantly on Windows, macOS, and Linux with no install required.

Key Takeaways

  • One binary bundles the TinyCC compiler, all headers, and stdlib – no system-wide install, no IDE, no EULA to accept.
  • Built on TinyCC by Fabrice Bellard and inspired by HolyC from TempleOS; actively maintained by Jaromil and the Dyne.org open-source crew.
  • Can call any function from any shared library at runtime, enabling rapid prototyping against existing system or third-party libs.
  • Official cross-platform builds target Windows, macOS, and Linux; the binary stays under 2MB across all three.
  • Designed as a rapid C prototyping tool: write a .c file and execute it immediately, no build step.

Hacker News Comment Review

  • The “works everywhere” Linux claim breaks on Arch: the release binary is Ubuntu 24.04-specific, failing at runtime with a missing libgcc_s.so.1; SDL symbol resolution also fails after basic setup.
  • Commenters distinguish CJIT from plain tcc -run: the key additions are a fully self-contained binary with bundled headers and stdlib, plus support for multiple input files and wildcard ingestion in one execution.
  • The HolyC/Terry Davis lineage caught several readers off guard; pairing CJIT with Fil-C (memory-safe C dialect) was proposed as a path to a legitimate, safe C scripting layer.

Notable Comments

  • @taylorallred: Suggests pairing CJIT with Fil-C to get C as a “truly bonafide scripting language” with memory safety.
  • @notorandit: Plans to test whether CJIT can bootstrap itself the way GCC and LLVM can; FAQ is silent on this.

Original | Discuss on HN