On this page:
c-compile
c-link
c-ar
.c->.o
.exe
.a
config-merge
config-include
config-define

4.5 C Tools🔗ℹ

The zuo/c module is reprovided by zuo.

The C-tool procedures provided by zuo/c accept a tool configuration hash table to describe a C compiler, linker, archiver, and associated flags. When potential configuration is missing, a default suitable for the current toolchain is used, where the toolchain is determined through (hash-ref (runtime-env) 'toolchain-type). Values in a tool configuration hash table are shell-command fragments, not individual arguments. For example, it could make sense to configure 'CC as "libtool cc", which would run libtool in compilation mode, instead of trying to run a compile whose executable name includes a space.

The following keys are recognized in a tool configuration:

procedure

(c-compile .o .c config)  void?

  .o : path-string?
  .c : path-string?
  config : hash?
(c-compile out ins config)  void?
  out : path-string?
  ins : (listof path-string?)
  config : hash?
Compiles .c to .o using the tool configuration config, or combines compiling and linking by with ins compiled and linked to out using config.

procedure

(c-link .exe ins config)  void?

  .exe : path-string?
  ins : (listof path-string?)
  config : hash?
Links the files ins to create the executable .exe using the tool configuration config.

procedure

(c-ar .a ins config)  void?

  .a : path-string?
  ins : (listof path-string?)
  config : hash?
Combines the object files ins to create the archive .a using the tool configuration config.

procedure

(.c->.o .c)  path-string?

  .c : path-string?
Adjusts the filename .c to be the conventional name of its compiled object file on the current system.

procedure

(.exe name)  path-string?

  name : path-string?
Adds ".exe" to the end of name if conventional on the current system.

procedure

(.a name)  path-string?

  name : path-string?
Derives the conventional archive name for a library name on the current system.

procedure

(config-merge config key shell-str)  hash?

  config : hash?
  key : symbol?
  shell-str : string?
Adds shell-str to the shell-command fragment for key in the tool configuration config.

procedure

(config-include config path ...)  hash?

  config : hash?
  path : path-string?
Adds the paths as include directories in the tool configuration config.

procedure

(config-define config def ...)  hash?

  config : hash?
  def : string?
Adds the preprocessor definitions defs to preprocessor flags in the tool configuration config.