Skip to content

Commit 2d4b94b

Browse files
committed
update to wit-bindgen 0.33.0
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 3c6c736 commit 2d4b94b

File tree

3 files changed

+87
-51
lines changed

3 files changed

+87
-51
lines changed

Cargo.lock

Lines changed: 65 additions & 47 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

runtime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ once_cell = "1.20.2"
1212
pyo3 = { version = "0.20.0", features = ["abi3-py311", "num-bigint"] }
1313
componentize-py-shared = { path = "../shared" }
1414
num-bigint = "0.4.6"
15-
wit-bindgen = "0.19.0"
15+
wit-bindgen = "0.33.0"

runtime/src/lib.rs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ use {
2828
wit_bindgen::generate!({
2929
world: "init",
3030
path: "../wit",
31-
exports: {
32-
"exports": MyExports
33-
}
31+
generate_all,
3432
});
3533

34+
export!(MyExports);
35+
3636
static STUB_WASI: OnceCell<bool> = OnceCell::new();
3737
static EXPORTS: OnceCell<Vec<Export>> = OnceCell::new();
3838
static TYPES: OnceCell<Vec<Type>> = OnceCell::new();
@@ -1281,3 +1281,21 @@ pub mod dl {
12811281
static _CLOCK_PROCESS_CPUTIME_ID: u8 = 2;
12821282
#[no_mangle]
12831283
static _CLOCK_THREAD_CPUTIME_ID: u8 = 3;
1284+
1285+
// Traditionally, `wit-bindgen` would provide a `cabi_realloc` implementation, but recent versions use a weak
1286+
// symbol trick to avoid conflicts when more than one `wit-bindgen` version is used, and that trick does not
1287+
// currently play nice with how we build this library. So for now, we just define it ourselves here:
1288+
/// # Safety
1289+
/// TODO
1290+
#[export_name = "cabi_realloc"]
1291+
pub unsafe extern "C" fn cabi_realloc(
1292+
old_ptr: *mut u8,
1293+
old_len: usize,
1294+
align: usize,
1295+
new_size: usize,
1296+
) -> *mut u8 {
1297+
assert!(old_ptr.is_null());
1298+
assert!(old_len == 0);
1299+
1300+
alloc::alloc(Layout::from_size_align(new_size, align).unwrap())
1301+
}

0 commit comments

Comments
 (0)