Skip to content

Commit

Permalink
fix(ffi): cast void ptr to correct type
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Sep 18, 2024
1 parent 6583021 commit 72bfe7c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/sys/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::ptr::{self, null_mut};
use std::ffi::CString;
use std::sync::{LazyLock, Mutex};

use crate::{call, instantiate, Config};
use crate::{call, instantiate, Config, Instance};

static ERROR: LazyLock<Mutex<Option<CString>>> = LazyLock::new(Mutex::default);

Expand Down Expand Up @@ -48,7 +48,7 @@ pub extern "C" fn instance_new(config: Config) -> *mut c_void {

#[no_mangle]
pub extern "C" fn instance_free(instance: *mut c_void) {
unsafe { drop(Box::from_raw(instance)) }
unsafe { drop(Box::from_raw(instance.cast::<Instance>())) }
}

#[no_mangle]
Expand Down

0 comments on commit 72bfe7c

Please sign in to comment.