kcc

kcc

kcc is a drop-in replacement for clang / clang++ that understands Kairo. It takes clang's command line (C, C++, Objective-C and Objective-C++ sources, .k files, objects and archives) and runs clang in-process: the release ships no clang binary.

kcc main.cc -o app                 # a plain C++ build
kcc main.cc foo.k -o app           # C++ and Kairo in one link

Two additions over clang:

  • #include "foo.k" works in a C++ (or Objective-C++) file. The preprocessor reads the Kairo file's interface as C++ tokens, so the C++ side uses Kairo types and functions directly. Only pub declarations, and prot ones for a C++ file inside the same module, are visible.
  • .k inputs are compiled by the Kairo compiler and linked with everything else.

An option that Kairo has its own flag for becomes that flag; any other option reaches clang unchanged. kcc --help and kcc --version describe kcc, and -### prints each compile job and the link without running them.

kcc is the supported way to compile C++ in a Kairo project. See kairo, kcc & Cross-compilation for the toolchain model, sysroots, separate compilation and incremental builds, and Using Kairo in C++ for what a C++ file sees.