Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Foreign library import

Platform spec feature

Foreign library import

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

What this feature specifies

Foreign library import connects Beskid Extern(..., Library:"...") logical names to platform linker inputs for v0.3 link-time FFI.

It specifies:

  • The ExternalLibrary provider trait (Rust tooling) for per-platform / per-language resolution.
  • A beskid import lib (exact CLI name reserved) command for mapping and importing libraries into project manifests.
  • Interaction with project link libraries.

v0.3 scope

In scopeDeferred
C / POSIX library providers on tier-1 hostsWinAPI stdlib providers
Manifest link block population from CLIAutomatic C header parsing
Closed provider registry in CLIThird-party provider plugins (future)

Implementation in beskid_cli may trail spec; conformance is documented in article verification sections.

Implementation anchors

  • CLI subcommand: compiler/crates/beskid_cli/src/commands/import.rs (beskid import lib <name>).
  • Provider trait + closed registry: compiler/crates/beskid_analysis/src/external_library/ (ExternalLibrary trait, CPosixProvider, PosixProvider, ExternalLibraryRegistry).
  • Manifest link block parse/validate: compiler/crates/beskid_analysis/src/projects/{model,parser,validator}.rs (ProjectLinkSection, diagnostic codes E1890-E1893).
  • Non-destructive manifest merge: compiler/crates/beskid_analysis/src/external_library/manifest_merge.rs (idempotent in-place update of link { ... }).
  • Link driver integration: AOT / JIT link pipelines (see link-time linking).

Verification

  • Unit tests: compiler/crates/beskid_analysis/src/external_library/ modules (provider mapping, registry rejection, manifest merge) and beskid_cli::commands::import::tests (clap surface).
  • Integration tests: compiler/crates/beskid_tests/src/cli/import_lib.rs (end-to-end Project.proj mutation, idempotency, merging into existing link block, unknown provider / library rejection, path-input search paths, closed-registry assertion).
  • Smoke: beskid import lib libc against a fresh Project.proj populates link { libraries = [libc] } and is idempotent on repeat invocations.

Decisions

No open decisions. D-TOOL-FLI-0001 (link-time FFI v0.3), 0002 (closed provider registry)—see adr/ and the ADRs tab.

Articles