Janet 1.37.1-83e8aab Documentation
(Other Versions: 1.36.0 1.35.0 1.34.0 1.31.0 1.29.1 1.28.0 1.27.0 1.26.0 1.25.1 1.24.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.1 1.17.1 1.16.1 1.15.0 1.13.1 1.12.2 1.11.1 1.10.1 1.9.1 1.8.1 1.7.0 1.6.0 1.5.1 1.5.0 1.4.0 1.3.1 )

C Compiler Wrapper

Index

cc/*ar* cc/*build-dir* cc/*build-type* cc/*c++* cc/*c++-std* cc/*c++flags* cc/*c-std* cc/*cc* cc/*cflags* cc/*defines* cc/*dynamic-libs* cc/*lflags* cc/*libs* cc/*msvc-libs* cc/*msvc-vcvars* cc/*pkg-config-flags* cc/*smart-libs* cc/*static-libs* cc/*target-os* cc/*use-rdynamic* cc/*use-rpath* cc/*visit* cc/check-library-exists cc/compile-and-link-executable cc/compile-and-link-shared cc/compile-and-make-archive cc/compile-c cc/compile-c++ cc/link-executable-c cc/link-executable-c++ cc/link-shared-c cc/link-shared-c++ cc/load-settings cc/make-archive cc/msvc-compile-and-link-executable cc/msvc-compile-and-link-shared cc/msvc-compile-and-make-archive cc/msvc-compile-c cc/msvc-compile-c++ cc/msvc-find cc/msvc-janet-import-lib cc/msvc-link-executable cc/msvc-link-shared cc/msvc-make-archive cc/msvc-setup? cc/pkg-config cc/save-settings cc/search-dynamic-libraries cc/search-libraries cc/search-static-libraries cc/visit-clean cc/visit-do-nothing cc/visit-execute cc/visit-execute-if-stale cc/visit-execute-quiet cc/visit-generate-makefile


cc/*ar* keyword source
Archiver, defaults to `ar`.

cc/*build-dir* keyword source
If generating intermediate files, store them in this directory

cc/*build-type* keyword source
Presets for compiler optimizations, can be :release, :develop, and :debug, defaults to :develop.

cc/*c++* keyword source
C++ compiler, defaults to `c++`.

cc/*c++-std* keyword source
C++ standard to use as a 2 digit number, defaults to 11 on GCC-like compilers, 14 on msvc.

cc/*c++flags* keyword source
Extra C++ compiler flags to use during compilation

cc/*c-std* keyword source
C standard to use as a 2 digit number, defaults to 99 on GCC-like compilers, 11 on msvc.

cc/*cc* keyword source
C compiler, defaults to `cc`.

cc/*cflags* keyword source
Extra C compiler flags to use during compilation

cc/*defines* keyword source
Map of extra defines to use when compiling

cc/*dynamic-libs* keyword source
List of dynamic libraries to use when compiling

cc/*lflags* keyword source
Extra linker flags

cc/*libs* keyword source
List of libraries to use when compiling - can be static or dynamic depending on system.

cc/*msvc-libs* keyword source
List of .lib libraries to use when compiling with msvc

cc/*msvc-vcvars* keyword source
Path to vcvarsall.bat to use initialize MSVC environment. If unset, `msvc-find` will try to guess using typical install locations.

cc/*pkg-config-flags* keyword source
Extra flags to pass to pkg-config

cc/*smart-libs* keyword source
Try to resolve circular or out-of-order dependencies between libraries by using --start-group and --end-group.
Some linkers support this by default, but not at all. Defaults to true on linux and macos.

cc/*static-libs* keyword source
List of static libraries to use when compiling

cc/*target-os* keyword source
Operating system to assume is being used for target compiler toolchain

cc/*use-rdynamic* keyword source
Optional setting to enable using `-rdynamic` or `-Wl,-export_dynamic` when linking executables.
This is the preferred way on POSIX systems to let an executable load native modules dynamically at runtime.
Defaults to true

cc/*use-rpath* keyword source
Optional setting to enable using `(dyn *syspath*)` as the runtime path to load for Shared Objects. Defaults to true

cc/*visit* keyword source
Optional callback to process each CLI command and its inputs and outputs

cc/check-library-exists function source
(check-library-exists libname &opt binding test-source-code)

Check if a library exists on the current POSIX system. Will run a test compilation and return true if the compilation succeeds. Libname is passed directly to the compiler/linker, such as `-lm` on GNU/Linux.

cc/compile-and-link-executable function source
(compile-and-link-executable to & sources)

Compile and link an executable C/C++ program. Return an array of commands.

cc/compile-and-link-shared function source
(compile-and-link-shared to & sources)

Compile and link a shared C/C++ library. Return an array of commands.

cc/compile-and-make-archive function source
(compile-and-make-archive to & sources)

Compile and create a static archive. Return an array of commands.

cc/compile-c function source
(compile-c from to)

Compile a C program to an object file. Return the command arguments.

cc/compile-c++ function source
(compile-c++ from to)

Compile a C++ program to an object file. Return the command arguments.

cc/link-executable-c function source
(link-executable-c objects to)

Link a C program to make an executable. Return the command arguments.

cc/link-executable-c++ function source
(link-executable-c++ objects to)

Link a C++ program to make an executable. Return the command arguments.

cc/link-shared-c function source
(link-shared-c objects to)

Link a C program to make a shared library. Return the command arguments.

cc/link-shared-c++ function source
(link-shared-c++ objects to)

Link a C++ program to make a shared library. Return the command arguments.

cc/load-settings function source
(load-settings settings)

Load settings from a snapshot of settings saved with `save-settings`.

cc/make-archive function source
(make-archive objects to)

Make an archive file. Return the command arguments.

cc/msvc-compile-and-link-executable function source
(msvc-compile-and-link-executable to & sources)

Compile and link an executable C/C++ program. Return an array of commands.

cc/msvc-compile-and-link-shared function source
(msvc-compile-and-link-shared to & sources)

Compile and link a shared C/C++ library. Return an array of commands.

cc/msvc-compile-and-make-archive function source
(msvc-compile-and-make-archive to & sources)

Compile and create a static archive. Return an array of commands.

cc/msvc-compile-c function source
(msvc-compile-c from to)

Compile a C program with MSVC. Return the command arguments.

cc/msvc-compile-c++ function source
(msvc-compile-c++ from to)

Compile a C++ program with MSVC. Return the command arguments.

cc/msvc-find function source
(msvc-find)

Find vcvarsall.bat and run it to setup the current environment for building. Uses `(dyn *msvc-vcvars*)` to find the location of the setup script, otherwise defaults to checking typical install locations for Visual Studio. Supports VS 2017, 2019, and 2022, any edition. Will set environment variables such that invocations of cl.exe, link.exe, etc. will work as expected.

cc/msvc-janet-import-lib function source
(msvc-janet-import-lib)

Get path to the installed Janet import lib. This import lib is needed when create dlls for natives.

cc/msvc-link-executable function source
(msvc-link-executable objects to)

Link a C/C++ program with MSVC to make an executable. Return the command arguments.

cc/msvc-link-shared function source
(msvc-link-shared objects to)

Link a C/C++ program with MSVC to make a shared library. Return the command arguments.

cc/msvc-make-archive function source
(msvc-make-archive objects to)

Make an archive file with MSVC. Return the command arguments.

cc/msvc-setup? function source
(msvc-setup?)

Check if MSVC environment is already setup.

cc/pkg-config function source
(pkg-config & pkg-config-libraries)

Setup defines, cflags, and library flags from pkg-config.

cc/save-settings function source
(save-settings)

Get a snapshot of the current settings for various compiler flags, libraries, defines, etc. that can be loaded later.

cc/search-dynamic-libraries function source
(search-dynamic-libraries & libs)

Search for dynamic libraries on the current POSIX system and configure `(dyn *dynamic-libraries*)`. This is done by checking for the existence of libraries with `check-library-exists`. Returns an array of libraries that were not found.

cc/search-libraries function source
(search-libraries & libs)

Search for libraries on the current POSIX system and configure `(dyn *libs*)`. This is done by checking for the existence of libraries with `check-library-exists`. Returns an array of libraries that were not found.

cc/search-static-libraries function source
(search-static-libraries & libs)

Search for static libraries on the current POSIX system and configure `(dyn *static-libs*)`. This is done by checking for the existence of libraries with `check-library-exists`. Returns an array of libraries that were not found.

cc/visit-clean function source
(visit-clean cmd inputs outputs message)

A visiting function that will remove all outputs.

cc/visit-do-nothing function source
(visit-do-nothing &)

A visiting function that has no side effects and therefor does nothing.

cc/visit-execute function source
(visit-execute cmd inputs outputs message)

A function that can be provided as `(dyn *visit*)` that will execute commands.

cc/visit-execute-if-stale function source
(visit-execute-if-stale cmd inputs outputs message)

A function that can be provided as `(dyn *visit*)` that will execute a command if inputs are newer than outputs, providing a simple, single-threaded, incremental build tool. This is not optimal for parallel builds, but is simple and works well for small projects.

cc/visit-execute-quiet function source
(visit-execute-quiet cmd inputs outputs message)

A function that can be provided as `(dyn *visit*)` that will execute commands quietly.

cc/visit-generate-makefile function source
(visit-generate-makefile cmd inputs outputs message)

A function that can be provided as `(dyn *visit*)` that will generate Makefile targets.