On this page:
6.1 External Processes
exn:  fail:  process
6.2 GCC
current-gcc
gcc

6 Evaluation🔗ℹ

This library provides utilities for building and running C programs with a system-installed C compiler. Currently the only supported compiler is GCC.

 (require c/eval) package: c-utils

6.1 External Processes🔗ℹ

struct

(struct exn:fail:process exn:fail (out error-out)
    #:extra-constructor-name make-exn:fail:process)
  out : input-port?
  error-out : input-port?
Raised when a system error occurs in executing an external process.

6.2 GCC🔗ℹ

parameter

(current-gcc)  (or/c path? #f)

(current-gcc gcc)  void?
  gcc : (or/c path? #f)
The path to the GCC executable. By default, this is initialized to:
(or (find-executable-path "gcc")
    (find-executable-path "gcc.exe"))

procedure

(gcc print-source)  
input-port? input-port?
  print-source : (-> any)
Runs a C program with GCC, using the value of current-gcc to find the GCC executable. The program source is obtained by invoking print-source, which is run in a continuation barrier to prevent re-entrant evaluation. The external program is built to a temporary file which is automatically deleted after the program terminates.

The external program is run in a separate thread, so this procedure returns before the program necessarily terminates. The procedure produces two values, input ports for reading from the external program’s stdout and stderr ports.