Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use once_cell trouble #122

Open
JonyTony opened this issue Mar 10, 2023 · 0 comments
Open

use once_cell trouble #122

JonyTony opened this issue Mar 10, 2023 · 0 comments
Labels

Comments

@JonyTony
Copy link

I want to use libloading to share some static variable by once_cell, but it is still None after I change it. like this:

let cell = value_from_lib();
cell.set(10).unwrap();
let val = cell.get();
assert!(val.is_some());
let cell = value_from_lib();
let val = cell.get();
assert!(val.is_none());

my static variable like this:

#[no_mangle]
pub static STATIC_VALUE: OnceCell<i32> = OnceCell::new();
@JonyTony JonyTony changed the title support once_cell? use once_cell trouble Mar 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants