-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactors linking * remove , anyhow::Error from prelink * fmt * formatting * nightly compiler/lint fixes (#129) * test * trigger test workflow * remove lint from workflow * lint/compiler fixes * re-adds readme --------- Co-authored-by: Phil Cummins <philip.cummins@bsc.es> --------- Co-authored-by: Phil Cummins <philip.cummins@bsc.es>
- Loading branch information
Showing
3 changed files
with
39 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::io::Cursor; | ||
|
||
use anyhow::Result; | ||
|
||
use crate::Library; | ||
|
||
pub fn link_libraries(libraries: &[Library]) -> Result<Vec<u8>> { | ||
let mut linker = wit_component::Linker::default() | ||
.validate(true) | ||
.use_built_in_libdl(true); | ||
|
||
for Library { | ||
name, | ||
module, | ||
dl_openable, | ||
} in libraries | ||
{ | ||
linker = linker.library(name, module, *dl_openable)?; | ||
} | ||
|
||
linker = linker.adapter( | ||
"wasi_snapshot_preview1", | ||
&zstd::decode_all(Cursor::new(include_bytes!(concat!( | ||
env!("OUT_DIR"), | ||
"/wasi_snapshot_preview1.reactor.wasm.zst" | ||
))))?, | ||
)?; | ||
|
||
linker.encode().map_err(|e| anyhow::anyhow!(e)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters