Dynamic load deferred.
Foreign library import
Platform spec feature
Foreign library import
Spec standingStandard
-
Link-time FFI
Context
Decision
v0.3 maps Extern libraries to link-time providers.
Consequences
C ABI profile.
Verification anchors
Foreign-library import tests.
-
Closed providers
Context
Plugin security.
Decision
v0.3 closed provider registry; plugins deferred.
Consequences
Tier-1 hosts only.
Verification anchors
CLI provider list.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
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
ExternalLibraryprovider 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 scope | Deferred |
|---|---|
| C / POSIX library providers on tier-1 hosts | WinAPI stdlib providers |
Manifest link block population from CLI | Automatic C header parsing |
| Closed provider registry in CLI | Third-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/(ExternalLibrarytrait,CPosixProvider,PosixProvider,ExternalLibraryRegistry). - Manifest
linkblock 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 oflink { ... }). - 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) andbeskid_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 existinglinkblock, unknown provider / library rejection, path-input search paths, closed-registry assertion). - Smoke:
beskid import lib libcagainst a freshProject.projpopulateslink { 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.