Skip to content

feat: C interop support (import c"...", c. prefix) #8

Open

Description

@SchoolyB

Summary

Grayscale supports C interop (STANDARD.md §8.6) — importing C headers and calling C functions. The LSP has no awareness of this feature.

Example

import c"stdio.h"
import c"stdlib.h", c"string.h"

do main() {
    c.puts("hello from C")
    c.printf("value: %d\n", 42)
    mut home string = c_string(c.getenv("HOME"))
}

Key Details

  • import c"header.h" — system header (angle-bracket include)
  • import c"./mylib.h" — local header (quoted include)
  • All C functions accessed via c. prefix
  • Module name c is reserved for C interop

Scope

  • Recognize import c"..." syntax (no false diagnostics)
  • Recognize c. prefix as valid module access
  • Add hover docs explaining C interop basics

Activity

  1. added a commit that references this issue on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions