language · language ·

C ABI interop

extern c declares an external function with cdecl by default and optional stdcall or sysv conventions.

ccdeclcomplete-programcpuexternlanguagepackagesstdcallsysvyeho

Use C interop at a narrow adapter boundary after confirming the exact target ABI and admitted scalar types.

extern c Name(Type parameter) -> ReturnType
extern c stdcall Name(...)

Status: experimental

Extern abi manifest

Use C interop at a narrow adapter boundary after confirming the exact target ABI and admitted scalar types.

cpu · complete-program · type checked

extern c NativeScore(int value) returns int
extern c stdcall NativeFlag(bool enabled) returns bool

Console.Log("extern-abi-manifest-ok")


project.mech
package = "tests.compiler.kyber.externAbiManifest"
version = "0.1.0"
backend = "kyber"
osTarget = "windows"
archTarget = "x64"
selfContainedApp = false
capabilities = ["native"]
acknowledgedAdvisories = ["extern.c"]



Notes and source

The bootstrap compiler supports only extern c.

Interop beyond admitted scalars is experimental and must match the target ABI exactly.

yeho/parser_declarations.cpp parseExternFunction; conformance extern-c-beyond-admitted-scalars