mirror of
https://github.com/fluencelabs/wasmer
synced 2025-04-25 10:22:19 +00:00
Readjust where things are exported in the new API
This commit is contained in:
parent
bf09dc5e67
commit
4f23ed7f20
@ -282,13 +282,16 @@ pub mod codegen {
|
|||||||
// TODO: `import` or `imports`?
|
// TODO: `import` or `imports`?
|
||||||
pub mod import {
|
pub mod import {
|
||||||
//! Types and functions for Wasm imports.
|
//! Types and functions for Wasm imports.
|
||||||
pub use wasmer_runtime_core::import::{ImportObject, ImportObjectIterator, LikeNamespace, Namespace};
|
pub use wasmer_runtime_core::import::{
|
||||||
|
ImportObject, ImportObjectIterator, LikeNamespace, Namespace,
|
||||||
|
};
|
||||||
pub use wasmer_runtime_core::types::{ExternDescriptor, ImportDescriptor};
|
pub use wasmer_runtime_core::types::{ExternDescriptor, ImportDescriptor};
|
||||||
pub use wasmer_runtime_core::{func, imports};
|
pub use wasmer_runtime_core::{func, imports};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod export {
|
pub mod export {
|
||||||
//! Types and functions for Wasm exports.
|
//! Types and functions for Wasm exports.
|
||||||
|
pub use wasmer_runtime_core::export::Export;
|
||||||
pub use wasmer_runtime_core::types::{ExportDescriptor, ExternDescriptor};
|
pub use wasmer_runtime_core::types::{ExportDescriptor, ExternDescriptor};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,23 +397,3 @@ impl CompiledModule for Module {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Below this line is things copied from `wasmer-runtime` to make the C API work.
|
|
||||||
// All these additions should be reviewed carefully before shipping.
|
|
||||||
|
|
||||||
/// Compile WebAssembly binary code into a [`Module`].
|
|
||||||
/// This function is useful if it is necessary to
|
|
||||||
/// compile a module before it can be instantiated
|
|
||||||
/// (otherwise, the [`instantiate`] function should be used).
|
|
||||||
///
|
|
||||||
/// [`Module`]: struct.Module.html
|
|
||||||
/// [`instantiate`]: fn.instantiate.html
|
|
||||||
///
|
|
||||||
/// # Params:
|
|
||||||
/// * `wasm`: A `&[u8]` containing the
|
|
||||||
/// binary code of the wasm module you want to compile.
|
|
||||||
/// # Errors:
|
|
||||||
/// If the operation fails, the function returns `Err(error::CompileError::...)`.
|
|
||||||
pub fn compile(wasm: &[u8]) -> error::CompileResult<Module> {
|
|
||||||
wasmer_runtime_core::compile_with(&wasm[..], &default_compiler())
|
|
||||||
}
|
|
||||||
|
@ -18,9 +18,10 @@ use std::{
|
|||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
use wasmer::import::{ImportObject, ImportObjectIterator};
|
use wasmer::import::{ImportObject, ImportObjectIterator};
|
||||||
use wasmer::wasm::{Ctx, FuncSig, Global, Memory, Module, Table, Type};
|
use wasmer::vm::Ctx;
|
||||||
|
use wasmer::wasm::{Export, FuncSig, Global, Memory, Module, Table, Type};
|
||||||
use wasmer_runtime_core::{
|
use wasmer_runtime_core::{
|
||||||
export::{Context, Export, FuncPointer},
|
export::{Context, FuncPointer},
|
||||||
module::ImportName,
|
module::ImportName,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,8 +11,8 @@ use crate::{
|
|||||||
use libc::{c_char, c_int, c_void};
|
use libc::{c_char, c_int, c_void};
|
||||||
use std::{collections::HashMap, ffi::CStr, ptr, slice};
|
use std::{collections::HashMap, ffi::CStr, ptr, slice};
|
||||||
use wasmer::import::{ImportObject, Namespace};
|
use wasmer::import::{ImportObject, Namespace};
|
||||||
use wasmer::wasm::{Ctx, Global, Instance, Memory, Table, Value};
|
use wasmer::vm::Ctx;
|
||||||
use wasmer_runtime_core::export::Export;
|
use wasmer::wasm::{Export, Global, Instance, Memory, Table, Value};
|
||||||
|
|
||||||
/// Opaque pointer to a `wasmer_runtime::Instance` value in Rust.
|
/// Opaque pointer to a `wasmer_runtime::Instance` value in Rust.
|
||||||
///
|
///
|
||||||
@ -164,7 +164,7 @@ pub unsafe extern "C" fn wasmer_instantiate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let bytes: &[u8] = slice::from_raw_parts_mut(wasm_bytes, wasm_bytes_len as usize);
|
let bytes: &[u8] = slice::from_raw_parts_mut(wasm_bytes, wasm_bytes_len as usize);
|
||||||
let module_result = wasmer::compile(bytes);
|
let module_result = wasmer::compiler::compile(bytes);
|
||||||
let module = match module_result {
|
let module = match module_result {
|
||||||
Ok(module) => module,
|
Ok(module) => module,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
@ -9,10 +9,11 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use libc::c_int;
|
use libc::c_int;
|
||||||
use std::{collections::HashMap, slice};
|
use std::{collections::HashMap, slice};
|
||||||
|
use wasmer::compiler::{compile, default_compiler};
|
||||||
use wasmer::import::{ImportObject, Namespace};
|
use wasmer::import::{ImportObject, Namespace};
|
||||||
use wasmer::wasm::{Global, Table};
|
use wasmer::wasm::{Export, Global, Table};
|
||||||
use wasmer::{compile, default_compiler, Instance, Memory, Module};
|
use wasmer::{Instance, Memory, Module};
|
||||||
use wasmer_runtime_core::{cache::Artifact, export::Export, load_cache_with};
|
use wasmer_runtime_core::{cache::Artifact, load_cache_with};
|
||||||
|
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
pub struct wasmer_module_t;
|
pub struct wasmer_module_t;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user