diff --git a/hpx-examples/src/main.rs b/hpx-examples/src/main.rs index d53eb16..e47ac83 100644 --- a/hpx-examples/src/main.rs +++ b/hpx-examples/src/main.rs @@ -1,7 +1,7 @@ #![feature(vec_into_raw_parts)] #![feature(random)] use core::array::from_fn; -use std::{env, ffi::c_char, process, random}; +use std::{env, process, random}; fn hpx_main(_: Vec) -> i32 { let numbers: &[i32; 16384] = &from_fn(|_| random::random::()); diff --git a/hpx-sys/src/lib.rs b/hpx-sys/src/lib.rs index d4a651e..bf83fe4 100644 --- a/hpx-sys/src/lib.rs +++ b/hpx-sys/src/lib.rs @@ -44,7 +44,7 @@ use std::env::Args; use std::ffi::{CString, CStr}; use std::os::raw::c_char; -static FUNC_HOLDER: Option) -> i32> = None; +static mut FUNC_HOLDER: Option) -> i32> = None; // Convert arguments from *mut *mut c_char to Vec // and call the saved Rust version of the function. @@ -66,7 +66,7 @@ fn c_init(argc: i32, argv: *mut *mut c_char) -> i32 { pub fn init(func: fn(Vec) -> i32, func_args: Vec) -> i32 { - FUNC_HOLDER = unsafe { Some(func) }; + unsafe { FUNC_HOLDER = Some(func) }; let str_args: Vec<&str> = func_args .iter() .map(|s| s.as_str())