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

Import

Binds a bodyless native-qualified function, linked module storage or runtime import-table field.

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

Module std.abi

import std.abi;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

Import

pub attribute Import

Binds a bodyless native-qualified function, linked module storage or runtime import-table field.

Callable qualifiers supply function ABI independently of this attribute. Global storage representation comes from its declared native-compatible type; imported let storage is a readonly view of live foreign storage. RuntimeRequired uses an unsafe callable slot; RuntimeOptional uses its optional form. RuntimeCompanionRequired/Optional select only the explicitly owned companion image, with the same unsafe and optional shape rules. Linked mode emits an ordinary linker reference. Runtime Version uses GNU lookup semantics and may resolve a compatible unversioned definition; it does not certify the selected definition's version metadata.

Import.Symbol

pub Symbol: str?;

Stores an optional exact native symbol spelling.

Import.Version

pub Version: str?;

Stores exact version-selector bytes; runtime selection follows GNU dlvsym compatibility.

Import.Mode

pub Mode: NativeImportMode;

Stores linked versus runtime resolution mode.

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