F.3 Platform Surface
With no C capability imports, the C backend implements only the core intrinsics. It does not provide:
- Linux
__syscall0__through__syscall6__ - browser/DOM/canvas intrinsics
- backend-provided builtin constants such as
SYS_WRITEorSTDOUT
Use importable C capability modules for common hosted C APIs:
import p"../third_party/c/stdlib.udewy"
let main = ():>int => {
let buf:int = calloc(4 8)
return buf =? 0
}
The checked-in C capability modules live under udewy/third_party/c/. The C backend recognizes imports of these ordinary udewy source modules and maps them to its private capability names:
hosted.udewy: marks that the program targets ordinary hosted Cstdio.udewy: importshosted.udewy, declares minimal stdio externs, and lets the C backend include<stdio.h>stdlib.udewy: importshosted.udewy, declares minimal stdlib externs, and lets the C backend include<stdlib.h>math.udewy: importshosted.udewy, lets the C backend include<math.h>, and links the host math library
This keeps the portability boundary explicit in source. Importing no C capability modules leaves the program in the minimal/freestanding-oriented profile.