Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Extern attribute schema

Platform spec article

Extern attribute schema

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

Applied only to contract declarations.

FieldRequiredMeaning
AbiyesIn v0.3 Standard, must be "C" (case-insensitive). Other values are reserved.
LibraryyesLogical library identity for link-time resolution (see link-time linking and foreign library import). Must be non-empty.

Example:

[Extern(Abi:"C", Library:"libc")]
pub contract Libc {
i64 getpid();
}

Contract methods may carry method-level attributes:

AttributeRequiredMeaning
SymbolnoLinker / foreign symbol name when it differs from the Beskid method name (for example Symbol:"pthread_create"). When omitted, the method identifier is the logical symbol.
LibrarynoOverrides contract-level Library for this method only.

Example:

[Extern(Abi:"C", Library:"libc.so.6")]
pub contract Libc {
[Symbol("write")]
i64 write(i32 fd, CBuffer buf, i64 count);
}
ModifierMeaning
(none)Borrow — caller retains ownership; foreign code must not retain pointers beyond the call unless documented otherwise.
TransferTransfer — ownership of the view’s storage obligation moves per profile rules (see ownership at the boundary).
GcPinProposed — GC-managed handle pinned for the call duration via runtime root handle; not required for Standard conformance in v0.3.0.

ref u8 remains valid as a byte slice start without length; authors should prefer CBuffer / CStringView interop views instead.

CodeCondition
E1510Extern applied to a disallowed declaration target
E1520Invalid Abi (not "C") — transition: T0901
E1521Missing Library — transition: T0902
E1522Disallowed extern parameter type — transition: T0903
E1523Disallowed extern return type — transition: T0904
E1524–E1539Export, interop views, link manifest — see registry

Full band: Diagnostic code registry / design model. Fixtures: compiler/crates/beskid_tests/src/analysis/ffi_v03_spec.rs.