On this page:
Inside:   Racket C API
6.11

Inside: Racket C API

Matthew Flatt

This manual describes the C interface of Racket’s run-time system. The C interface is relevant primarily when interacting with foreign libraries as described in The Racket Foreign Interface; even though interactions with foreign code are constructed in pure Racket using the ffi/unsafe module, many details of representations, memory management, and concurrency are described here. This manual also describes embedding the Racket run-time system in larger programs and extending Racket directly with C-implemented libraries.

    1 Overview

      1.1 “Scheme” versus “Racket”

      1.2 Building Racket from Source

      1.3 CGC versus 3m

      1.4 Embedding and Extending Racket

      1.5 Racket and Places

      1.6 Racket and Threads

      1.7 Racket, Unicode, Characters, and Strings

      1.8 Integers

    2 Embedding into a Program

      2.1 CGC Embedding

      2.2 3m Embedding

      2.3 Flags and Hooks

    3 Writing Racket Extensions

      3.1 CGC Extensions

      3.2 3m Extensions

      3.3 Declaring a Module in an Extension

    4 Values and Types

      4.1 Standard Types

      4.2 Global Constants

      4.3 Strings

      4.4 Value Functions

    5 Memory Allocation

      5.1 Cooperating with 3m

        5.1.1 Tagged Objects

        5.1.2 Local Pointers

        5.1.3 Local Pointers and raco ctool --xform

        5.1.4 Guiding raco ctool --xform

        5.1.5 Places and Garbage Collector Instances

      5.2 Memory Functions

    6 Namespaces and Modules

    7 Procedures

    8 Evaluation

      8.1 Top-level Evaluation Functions

      8.2 Tail Evaluation

      8.3 Multiple Values

      8.4 Evaluation Functions

    9 Exceptions and Escape Continuations

      9.1 Temporarily Catching Error Escapes

      9.2 Enabling and Disabling Breaks

      9.3 Exception Functions

    10 Threads

      10.1 Integration with Threads

      10.2 Allowing Thread Switches

      10.3 Blocking the Current Thread

      10.4 Threads in Embedded Racket with Event Loops

        10.4.1 Callbacks for Blocked Threads

      10.5 Sleeping by Embedded Racket

      10.6 Thread Functions

    11 Parameterizations

    12 Continuation Marks

    13 String Encodings

    14 Bignums, Rationals, and Complex Numbers

    15 Ports and the Filesystem

    16 Structures

    17 Security Guards

    18 Custodians

    19 Subprocesses

    20 Miscellaneous Utilities

    Index