Support vendored module mode for windows (raw-dylib linking)

This is requires Rust 1.71+
This commit is contained in:
Alex Orlenko
2023-07-18 01:45:20 +01:00
parent 0e030d21b0
commit 483e6be207
19 changed files with 188 additions and 31 deletions
+29 -4
View File
@@ -102,6 +102,10 @@ 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")
)]
extern "C" {
//
// State manipulation
@@ -167,19 +171,24 @@ pub const LUA_OPSHR: c_int = 11;
pub const LUA_OPUNM: c_int = 12;
pub const LUA_OPBNOT: c_int = 13;
extern "C" {
pub fn lua_arith(L: *mut lua_State, op: c_int);
}
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")
)]
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")
)]
extern "C" {
//
// Push functions (C -> stack)
@@ -270,6 +279,10 @@ 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")
)]
extern "C" {
//
// Coroutine functions
@@ -304,10 +317,18 @@ 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")
)]
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")
)]
extern "C" {
//
// Miscellaneous functions
@@ -463,6 +484,10 @@ 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")
)]
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;