Languages: English | 简体中文 | 繁體中文 | 日本語 | 한국어 | Français | Deutsch | Español | Italiano | Русский | العربية
← Documentation index · ← NeverC project
Compile a C or NeverC program to a temporary executable, execute it on the
local host, return its exit status, and remove the artifact afterward. The
workflow is intentionally similar to go run.
Use the normal compiler invocation (neverc ... -o output) when you need to keep
the binary, ship it, or debug it with a debugger.
neverc run [compiler flags] file.c [file2.nc ...] [program arguments...]
neverc run [compiler arguments...] -- [program arguments...]
Run neverc run --help for a built-in summary.
neverc run splits arguments into a compiler invocation and optional
program arguments using one of two rules.
- Scan left to right for the first argument whose name ends in
.cor.ncand does not start with-. - Everything before and including the consecutive run of
.c/.ncfiles is passed to the compiler. - Everything after that run is passed to
argvof the temporary program.
Examples:
# Compiler: -O2 -fbuiltin-string hello.c
# Program: (none)
neverc run -O2 -fbuiltin-string hello.c
# Compiler: -O2 main.c helper.nc
# Program: --verbose two words
neverc run -O2 main.c helper.nc -- --verbose two words
# Compiler: -DGENERATED=.c -O2 main.c
# Program: argument
neverc run -DGENERATED=.c -O2 main.c argumentNotes:
- Only
.cand.ncextensions are treated as run sources. A flag such as-DGENERATED=.cstays on the compiler side because it starts with-. - Multiple sources compile into one temporary binary, like a normal multi-file link.
When the compiler needs arguments after the source list (linker flags,
non-source inputs, -x c -, and similar), put -- between the compiler tail
and the program arguments:
# Compiler: hello.c helper.o -lm
# Program: arg.c -x (these are argv, not compiler flags)
neverc run hello.c helper.o -lm -- arg.c -x
# Compiler: hello.c -O1
# Program: x
neverc run hello.c -O1 -- xEverything before -- is forwarded verbatim to neverc (plus an internal
-o <temp>). Everything after -- becomes program arguments.
| Topic | Behavior |
|---|---|
| Working directory | The temporary program runs in your current directory. Relative paths behave the same as with a normal binary you built in that directory. |
| Environment | The process inherits the current environment (PATH, exported variables, and so on). |
| Standard I/O | stdin, stdout, and stderr are connected to the temporary process — pipes and redirects work as usual. |
| Exit status | On success, neverc run returns the program's exit code. If compilation fails, it returns the compiler's exit code and does not execute the program. |
| Temporary files | The executable lives under a unique neverc-run-* directory. The directory is removed after the run finishes (success or program failure). Cleanup failure is reported separately. |
Quick run with optimizations and the string builtin:
neverc run -O2 -fbuiltin-string hello.cPass arguments to main (including words with spaces):
neverc run -fbuiltin-string greet.c -- Alice "two words"Compile several translation units, then run:
neverc run -O2 main.c util.nc -- --port 8080Use -- when compiler arguments follow the sources:
neverc run app.c extra.o -lm -- --config prod.json- Host execution only.
neverc runalways tries to execute the temporary binary on the machine where you invokedneverc. Cross-compilation flags (-target ...) may still compile, but the result is usually not runnable locally. - No persistent artifact. You cannot attach a debugger to the output after
the command completes because the binary is deleted. Use
neverc ... -o outwhen you need a durable executable. - Same toolchain as
neverc. The command re-invokes the samenevercbinary that handledrun, forwarding your compiler flags unchanged (aside from-o). .ncsources. Native NeverC files use the same rules as.c; language extensions enabled for.ncapply automatically.
| Command | When to use it |
|---|---|
neverc file.c -o out |
Keep the binary, cross-compile, or integrate with build scripts |
neverc build / neverc make |
GNU Make–compatible builds driven by a Makefile |
neverc run --help |
Built-in usage summary |