Make sure symbol_name
is const evaluated
This commit is contained in:
parent
7f3d11e1d8
commit
bf0b18e910
1 changed files with 4 additions and 4 deletions
|
@ -180,8 +180,8 @@ macro_rules! compat_fn_with_fallback {
|
||||||
|
|
||||||
fn load_from_module(module: Option<Module>) -> F {
|
fn load_from_module(module: Option<Module>) -> F {
|
||||||
unsafe {
|
unsafe {
|
||||||
static symbol_name: &CStr = ansi_str!(sym $symbol);
|
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
|
||||||
if let Some(f) = module.and_then(|m| m.proc_address(symbol_name)) {
|
if let Some(f) = module.and_then(|m| m.proc_address(SYMBOL_NAME)) {
|
||||||
PTR.store(f.as_ptr(), Ordering::Relaxed);
|
PTR.store(f.as_ptr(), Ordering::Relaxed);
|
||||||
mem::transmute(f)
|
mem::transmute(f)
|
||||||
} else {
|
} else {
|
||||||
|
@ -262,8 +262,8 @@ macro_rules! compat_fn_optional {
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
pub(in crate::sys) fn preload(module: Module) {
|
pub(in crate::sys) fn preload(module: Module) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let symbol_name = ansi_str!(sym $symbol);
|
static SYMBOL_NAME: &CStr = ansi_str!(sym $symbol);
|
||||||
if let Some(f) = module.proc_address(symbol_name) {
|
if let Some(f) = module.proc_address(SYMBOL_NAME) {
|
||||||
PTR.store(f.as_ptr(), Ordering::Relaxed);
|
PTR.store(f.as_ptr(), Ordering::Relaxed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue