← board

C runtime/library layer (lib/crtl) plus direct C-library packages

Goal

Build a small, platonic C runtime/library layer for source-backed C libraries: the expected C headers and minimal implementations that candidate C libraries need, without pulling in host glibc/clang headers and without pretending to be a complete hosted libc.

This is Track B work: write the desired C library surface cleanly. Do not distort it around current compiler limitations. When the C frontend cannot compile the intended source, file Track A compiler tickets.

Proposed layout

lib/
  crtl/
    include/
      stddef.h
      stdint.h
      stdbool.h
      limits.h
      string.h
      ctype.h
      stdlib.h
      stdio.h
      errno.h
      signal.h
      setjmp.h
    src/
      string.c
      ctype.c
      stdlib.c
      stdio.c

  clib/
    <package>/
      package metadata
      include/
      src/

lib/crtl is the C compatibility substrate. Larger source-backed C libraries like regex, zlib, PNG, INI, etc. should get their own package folders, not be mixed into lib/crtl/src.

Scope policy

Naming / import design still open

Direct Pascal import of C packages is required; Pascal wrappers must be optional. For example, a user should be able to import zlib's C API without a Pascal wrapper, while a later Pascal-friendly zlib.pas wrapper can coexist.

Do not settle the namespace here. Known problem:

This needs a deliberate compiler/library namespace decision before accepted lib/clib packages become a public surface.

Acceptance

Log

Log