Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

C interoperability

Automatic C and C++ bindings for the native libraries your project uses.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

The intended 1.0 experience

Use C and C++ libraries from Sn without manually maintaining a parallel set of binding declarations. Automatic header imports, generated Sn declarations, and native ABI information are part of the language's interoperability design.

Automatic C binding is implemented. Direct C++ binding is planned and is intended to follow the same automatic workflow. The common native ABI foundation keeps calling conventions, native storage, symbol binding, and call safety explicit.

Generate from the real header

The C binding host uses Clang to read headers under the selected native compilation context. It produces inspectable Sn bindings with type, layout, constant, and source information.

Reuse unchanged bindings

First use or a changed header/context prepares new bindings. Valid cached bindings let ordinary checking, JIT, and AOT compilation proceed without reparsing foreign headers. Native header parsing is isolated from the ordinary compiler process.

The source includes authored native imports/exports and native-library loading. Runtime library owners keep the required library handles and callable tables together; callers still have to meet the native API's safety and lifetime contract.

C++ follows the native ABI

Direct C++ interoperability must account for C++ linkage, class layout, calling conventions, and the required native helpers. It is not a promise that C++ objects will be flattened into a universal C wrapper API.

The current driver explicitly defers automatic C++ preparation. C++ interoperability belongs in the intended language feature set, rather than in a claim of present compiler support.

Initial target

The automatic C implementation and its focused evidence are for Linux x86-64. Additional targets and direct C++ coverage remain development work. Use the release's documented compatibility rather than assuming every native header and platform is supported.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library