Version: 4.2.3

Inside: PLT Scheme C API

Matthew Flatt

This manual describes PLT Scheme’s C interface, which allows the interpreter to be extended by a dynamically-loaded library, or embedded within an arbitrary C/C++ program. The manual assumes familiarity with PLT Scheme as described in Reference: PLT Scheme.

For an alternative way of dealing with foreign code, see FFI: PLT Scheme Foreign Interface, which describes the scheme/foreign module for manipulating low-level libraries and structures purely through Scheme code.

    1 Overview

      1.1 CGC versus 3m

      1.2 Writing MzScheme Extensions

        1.2.1 CGC Extensions

        1.2.2 3m Extensions

      1.3 Embedding MzScheme into a Program

        1.3.1 CGC Embedding

        1.3.2 3m Embedding

      1.4 MzScheme and Threads

      1.5 MzScheme, Unicode, Characters, and Strings

      1.6 Integers

    2 Values and Types

      2.1 Standard Types

      2.2 Global Constants

      2.3 Strings

      2.4 Value Functions

    3 Memory Allocation

      3.1 Cooperating with 3m

        3.1.1 Tagged Objects

        3.1.2 Local Pointers

        3.1.3 Local Pointers and mzc --xform

        3.1.4 Guiding mzc --xform

      3.2 Memory Functions

    4 Namespaces and Modules

    5 Procedures

    6 Evaluation

      6.1 Top-level Evaluation Functions

      6.2 Tail Evaluation

      6.3 Multiple Values

      6.4 Evaluation Functions

    7 Exceptions and Escape Continuations

      7.1 Temporarily Catching Error Escapes

      7.2 Enabling and Disabling Breaks

      7.3 Exception Functions

    8 Threads

      8.1 Integration with Threads

      8.2 Allowing Thread Switches

      8.3 Blocking the Current Thread

      8.4 Threads in Embedded Scheme with Event Loops

        8.4.1 Callbacks for Blocked Threads

      8.5 Sleeping by Embedded Scheme

      8.6 Thread Functions

    9 Parameterizations

    10 Continuation Marks

    11 String Encodings

    12 Bignums, Rationals, and Complex Numbers

    13 Ports and the Filesystem

    14 Structures

    15 Security Guards

    16 Custodians

    17 Miscellaneous Utilities

    18 Flags and Hooks