From df9251fb52fb1c09c48f1e5d3cf6e5439a4e6daa Mon Sep 17 00:00:00 2001 From: Alex Orlenko Date: Fri, 21 Jul 2023 00:54:14 +0100 Subject: [PATCH] Support LUA_LIB_NAME in module mode for windows. In this mode we will link with the particular lua library. --- mlua-sys/build/find_normal.rs | 3 ++- mlua-sys/build/main_inner.rs | 15 +++++++++++-- mlua-sys/src/lua51/lauxlib.rs | 10 ++------- mlua-sys/src/lua51/lua.rs | 20 ++++-------------- mlua-sys/src/lua51/lualib.rs | 5 +---- mlua-sys/src/lua52/lauxlib.rs | 15 +++---------- mlua-sys/src/lua52/lua.rs | 35 ++++++------------------------ mlua-sys/src/lua52/lualib.rs | 5 +---- mlua-sys/src/lua53/lauxlib.rs | 15 +++---------- mlua-sys/src/lua53/lua.rs | 35 ++++++------------------------ mlua-sys/src/lua53/lualib.rs | 5 +---- mlua-sys/src/lua54/lauxlib.rs | 15 +++---------- mlua-sys/src/lua54/lua.rs | 40 +++++++---------------------------- mlua-sys/src/lua54/lualib.rs | 5 +---- 14 files changed, 56 insertions(+), 167 deletions(-) diff --git a/mlua-sys/build/find_normal.rs b/mlua-sys/build/find_normal.rs index 9867720..655814b 100644 --- a/mlua-sys/build/find_normal.rs +++ b/mlua-sys/build/find_normal.rs @@ -36,10 +36,11 @@ pub fn probe_lua() { #[cfg(feature = "luajit")] let (incl_bound, excl_bound, alt_probe, ver) = ("2.0.4", "2.2", None, "JIT"); + #[rustfmt::skip] let mut lua = pkg_config::Config::new() .range_version((Bound::Included(incl_bound), Bound::Excluded(excl_bound))) .cargo_metadata(true) - .probe("lua"); + .probe(if cfg!(feature = "luajit") { "luajit" } else { "lua" }); if lua.is_err() && alt_probe.is_some() { lua = pkg_config::Config::new() diff --git a/mlua-sys/build/main_inner.rs b/mlua-sys/build/main_inner.rs index 170dbf0..9b8b15d 100644 --- a/mlua-sys/build/main_inner.rs +++ b/mlua-sys/build/main_inner.rs @@ -15,8 +15,19 @@ fn main() { #[cfg(all(feature = "module", feature = "vendored"))] compile_error!("`vendored` and `module` features are mutually exclusive"); + println!("cargo:rerun-if-changed=build"); + + #[cfg(windows)] + if cfg!(feature = "module") { + if !std::env::var("LUA_LIB_NAME").unwrap_or_default().is_empty() { + // Don't use raw-dylib linking + find::probe_lua(); + return; + } + + println!("cargo:rustc-cfg=raw_dylib"); + } + #[cfg(not(feature = "module"))] find::probe_lua(); - - println!("cargo:rerun-if-changed=build"); } diff --git a/mlua-sys/src/lua51/lauxlib.rs b/mlua-sys/src/lua51/lauxlib.rs index 1388840..409c77f 100644 --- a/mlua-sys/src/lua51/lauxlib.rs +++ b/mlua-sys/src/lua51/lauxlib.rs @@ -14,10 +14,7 @@ pub struct luaL_Reg { pub func: lua_CFunction, } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { pub fn luaL_register(L: *mut lua_State, libname: *const c_char, l: *const luaL_Reg); #[link_name = "luaL_getmetafield"] @@ -60,10 +57,7 @@ extern "C" { pub const LUA_NOREF: c_int = -2; pub const LUA_REFNIL: c_int = -1; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int; pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int); diff --git a/mlua-sys/src/lua51/lua.rs b/mlua-sys/src/lua51/lua.rs index a950db4..50fd30e 100644 --- a/mlua-sys/src/lua51/lua.rs +++ b/mlua-sys/src/lua51/lua.rs @@ -89,10 +89,7 @@ pub type lua_Alloc = unsafe extern "C" fn( nsize: usize, ) -> *mut c_void; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { // // State manipulation @@ -222,10 +219,7 @@ pub const LUA_GCSTEP: c_int = 5; pub const LUA_GCSETPAUSE: c_int = 6; pub const LUA_GCSETSTEPMUL: c_int = 7; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int; } @@ -233,10 +227,7 @@ extern "C" { // // Miscellaneous functions // -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { pub fn lua_error(L: *mut lua_State) -> !; pub fn lua_next(L: *mut lua_State, idx: c_int) -> c_int; @@ -362,10 +353,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize); /// Type for functions to be called on debug events. pub type lua_Hook = unsafe extern "C" fn(L: *mut lua_State, ar: *mut lua_Debug); -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int; pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int; diff --git a/mlua-sys/src/lua51/lualib.rs b/mlua-sys/src/lua51/lualib.rs index b179695..e0f6d0f 100644 --- a/mlua-sys/src/lua51/lualib.rs +++ b/mlua-sys/src/lua51/lualib.rs @@ -20,10 +20,7 @@ pub const LUA_JITLIBNAME: &str = "jit"; #[cfg(feature = "luajit")] pub const LUA_FFILIBNAME: &str = "ffi"; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua51", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua51", kind = "raw-dylib"))] extern "C" { pub fn luaopen_base(L: *mut lua_State) -> c_int; pub fn luaopen_table(L: *mut lua_State) -> c_int; diff --git a/mlua-sys/src/lua52/lauxlib.rs b/mlua-sys/src/lua52/lauxlib.rs index ac5a6d1..6ac3983 100644 --- a/mlua-sys/src/lua52/lauxlib.rs +++ b/mlua-sys/src/lua52/lauxlib.rs @@ -14,10 +14,7 @@ pub struct luaL_Reg { pub func: lua_CFunction, } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number); @@ -69,10 +66,7 @@ extern "C" { pub const LUA_NOREF: c_int = -2; pub const LUA_REFNIL: c_int = -1; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int; pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int); @@ -86,10 +80,7 @@ pub unsafe fn luaL_loadfile(L: *mut lua_State, f: *const c_char) -> c_int { luaL_loadfilex(L, f, ptr::null()) } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn luaL_loadbufferx( L: *mut lua_State, diff --git a/mlua-sys/src/lua52/lua.rs b/mlua-sys/src/lua52/lua.rs index 4194a0d..4e244e2 100644 --- a/mlua-sys/src/lua52/lua.rs +++ b/mlua-sys/src/lua52/lua.rs @@ -94,10 +94,7 @@ pub type lua_Alloc = unsafe extern "C" fn( nsize: usize, ) -> *mut c_void; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { // // State manipulation @@ -163,20 +160,14 @@ pub const LUA_OPEQ: c_int = 0; pub const LUA_OPLT: c_int = 1; pub const LUA_OPLE: c_int = 2; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn lua_arith(L: *mut lua_State, op: c_int); pub fn lua_rawequal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int; pub fn lua_compare(L: *mut lua_State, idx1: c_int, idx2: c_int, op: c_int) -> c_int; } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { // // Push functions (C -> stack) @@ -271,10 +262,7 @@ pub unsafe fn lua_pcall(L: *mut lua_State, n: c_int, r: c_int, f: c_int) -> c_in lua_pcallk(L, n, r, f, 0, None) } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { // // Coroutine functions @@ -311,18 +299,12 @@ pub const LUA_GCISRUNNING: c_int = 9; pub const LUA_GCGEN: c_int = 10; pub const LUA_GCINC: c_int = 11; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int; } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { // // Miscellaneous functions @@ -460,10 +442,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize); /// Type for functions to be called on debug events. pub type lua_Hook = unsafe extern "C" fn(L: *mut lua_State, ar: *mut lua_Debug); -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int; pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int; diff --git a/mlua-sys/src/lua52/lualib.rs b/mlua-sys/src/lua52/lualib.rs index 3c79c7f..271e5a5 100644 --- a/mlua-sys/src/lua52/lualib.rs +++ b/mlua-sys/src/lua52/lualib.rs @@ -14,10 +14,7 @@ pub const LUA_MATHLIBNAME: &str = "math"; pub const LUA_DBLIBNAME: &str = "debug"; pub const LUA_LOADLIBNAME: &str = "package"; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua52", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua52", kind = "raw-dylib"))] extern "C" { pub fn luaopen_base(L: *mut lua_State) -> c_int; pub fn luaopen_coroutine(L: *mut lua_State) -> c_int; diff --git a/mlua-sys/src/lua53/lauxlib.rs b/mlua-sys/src/lua53/lauxlib.rs index 40a0655..3d5b550 100644 --- a/mlua-sys/src/lua53/lauxlib.rs +++ b/mlua-sys/src/lua53/lauxlib.rs @@ -20,10 +20,7 @@ pub struct luaL_Reg { pub func: lua_CFunction, } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number, sz: usize); @@ -71,10 +68,7 @@ extern "C" { pub const LUA_NOREF: c_int = -2; pub const LUA_REFNIL: c_int = -1; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int; pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int); @@ -88,10 +82,7 @@ pub unsafe fn luaL_loadfile(L: *mut lua_State, f: *const c_char) -> c_int { luaL_loadfilex(L, f, ptr::null()) } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { pub fn luaL_loadbufferx( L: *mut lua_State, diff --git a/mlua-sys/src/lua53/lua.rs b/mlua-sys/src/lua53/lua.rs index a76fd25..3329beb 100644 --- a/mlua-sys/src/lua53/lua.rs +++ b/mlua-sys/src/lua53/lua.rs @@ -102,10 +102,7 @@ pub type lua_Alloc = unsafe extern "C" fn( nsize: usize, ) -> *mut c_void; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { // // State manipulation @@ -175,20 +172,14 @@ pub const LUA_OPEQ: c_int = 0; pub const LUA_OPLT: c_int = 1; pub const LUA_OPLE: c_int = 2; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { pub fn lua_arith(L: *mut lua_State, op: c_int); pub fn lua_rawequal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int; pub fn lua_compare(L: *mut lua_State, idx1: c_int, idx2: c_int, op: c_int) -> c_int; } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { // // Push functions (C -> stack) @@ -279,10 +270,7 @@ pub unsafe fn lua_pcall(L: *mut lua_State, n: c_int, r: c_int, f: c_int) -> c_in lua_pcallk(L, n, r, f, 0, None) } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { // // Coroutine functions @@ -317,18 +305,12 @@ pub const LUA_GCSETPAUSE: c_int = 6; pub const LUA_GCSETSTEPMUL: c_int = 7; pub const LUA_GCISRUNNING: c_int = 9; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { pub fn lua_gc(L: *mut lua_State, what: c_int, data: c_int) -> c_int; } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { // // Miscellaneous functions @@ -484,10 +466,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize); /// Type for functions to be called on debug events. pub type lua_Hook = unsafe extern "C" fn(L: *mut lua_State, ar: *mut lua_Debug); -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int; pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int; diff --git a/mlua-sys/src/lua53/lualib.rs b/mlua-sys/src/lua53/lualib.rs index c70867a..85c18c2 100644 --- a/mlua-sys/src/lua53/lualib.rs +++ b/mlua-sys/src/lua53/lualib.rs @@ -15,10 +15,7 @@ pub const LUA_MATHLIBNAME: &str = "math"; pub const LUA_DBLIBNAME: &str = "debug"; pub const LUA_LOADLIBNAME: &str = "package"; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua53", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua53", kind = "raw-dylib"))] extern "C" { pub fn luaopen_base(L: *mut lua_State) -> c_int; pub fn luaopen_coroutine(L: *mut lua_State) -> c_int; diff --git a/mlua-sys/src/lua54/lauxlib.rs b/mlua-sys/src/lua54/lauxlib.rs index 7a97365..9b85474 100644 --- a/mlua-sys/src/lua54/lauxlib.rs +++ b/mlua-sys/src/lua54/lauxlib.rs @@ -20,10 +20,7 @@ pub struct luaL_Reg { pub func: lua_CFunction, } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn luaL_checkversion_(L: *mut lua_State, ver: lua_Number, sz: usize); @@ -70,10 +67,7 @@ extern "C" { pub const LUA_NOREF: c_int = -2; pub const LUA_REFNIL: c_int = -1; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn luaL_ref(L: *mut lua_State, t: c_int) -> c_int; pub fn luaL_unref(L: *mut lua_State, t: c_int, r#ref: c_int); @@ -87,10 +81,7 @@ pub unsafe fn luaL_loadfile(L: *mut lua_State, f: *const c_char) -> c_int { luaL_loadfilex(L, f, ptr::null()) } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn luaL_loadbufferx( L: *mut lua_State, diff --git a/mlua-sys/src/lua54/lua.rs b/mlua-sys/src/lua54/lua.rs index 605ac30..bc04656 100644 --- a/mlua-sys/src/lua54/lua.rs +++ b/mlua-sys/src/lua54/lua.rs @@ -105,10 +105,7 @@ pub type lua_Alloc = unsafe extern "C" fn( pub type lua_WarnFunction = unsafe extern "C" fn(ud: *mut c_void, msg: *const c_char, tocont: c_int); -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { // // State manipulation @@ -182,20 +179,14 @@ pub const LUA_OPEQ: c_int = 0; pub const LUA_OPLT: c_int = 1; pub const LUA_OPLE: c_int = 2; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn lua_arith(L: *mut lua_State, op: c_int); pub fn lua_rawequal(L: *mut lua_State, idx1: c_int, idx2: c_int) -> c_int; pub fn lua_compare(L: *mut lua_State, idx1: c_int, idx2: c_int, op: c_int) -> c_int; } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { // // Push functions (C -> stack) @@ -286,10 +277,7 @@ pub unsafe fn lua_pcall(L: *mut lua_State, n: c_int, r: c_int, f: c_int) -> c_in lua_pcallk(L, n, r, f, 0, None) } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { // // Coroutine functions @@ -318,10 +306,7 @@ pub unsafe fn lua_yield(L: *mut lua_State, n: c_int) -> c_int { // // Warning-related functions // -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn lua_setwarnf(L: *mut lua_State, f: Option, ud: *mut c_void); pub fn lua_warning(L: *mut lua_State, msg: *const c_char, tocont: c_int); @@ -342,18 +327,12 @@ pub const LUA_GCISRUNNING: c_int = 9; pub const LUA_GCGEN: c_int = 10; pub const LUA_GCINC: c_int = 11; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn lua_gc(L: *mut lua_State, what: c_int, ...) -> c_int; } -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { // // Miscellaneous functions @@ -527,10 +506,7 @@ pub const LUA_MASKCOUNT: c_int = 1 << (LUA_HOOKCOUNT as usize); /// Type for functions to be called on debug events. pub type lua_Hook = unsafe extern "C" fn(L: *mut lua_State, ar: *mut lua_Debug); -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn lua_getstack(L: *mut lua_State, level: c_int, ar: *mut lua_Debug) -> c_int; pub fn lua_getinfo(L: *mut lua_State, what: *const c_char, ar: *mut lua_Debug) -> c_int; diff --git a/mlua-sys/src/lua54/lualib.rs b/mlua-sys/src/lua54/lualib.rs index e9fd29b..876ea5b 100644 --- a/mlua-sys/src/lua54/lualib.rs +++ b/mlua-sys/src/lua54/lualib.rs @@ -14,10 +14,7 @@ pub const LUA_MATHLIBNAME: &str = "math"; pub const LUA_DBLIBNAME: &str = "debug"; pub const LUA_LOADLIBNAME: &str = "package"; -#[cfg_attr( - all(windows, feature = "module", feature = "vendored"), - link(name = "lua54", kind = "raw-dylib") -)] +#[cfg_attr(all(windows, raw_dylib), link(name = "lua54", kind = "raw-dylib"))] extern "C" { pub fn luaopen_base(L: *mut lua_State) -> c_int; pub fn luaopen_coroutine(L: *mut lua_State) -> c_int;