Skip to content

Conversation

tari
Copy link
Contributor

@tari tari commented Dec 6, 2023

This fixes some ABI issues I encountered while building for wasm32-unknown-emscripten after enabling lua-src to build with mlua-rs/lua-src-rs#8. The public API is unchanged despite needing to change some of the FFI declarations.

Commit b16f389 isn't a wasm-specific fix, but the issue it causes is unlikely to be noticed on other platforms unless it causes an ABI break leading to crashes.

tari added 2 commits December 6, 2023 21:09
Lua 5.4 changed lua_rawlen to return lua_Unsigned, versus size_t in earlier
versions. Change the C API signature to match, and add a wrapper function with
the same name that maintains a stable Rust API by casting to usize.
The definition of lua_error in all of Lua 5.1 through 5.4 says lua_error
returns int, but the Rust definition of the same function treats it as
void (because it's known not to return). This causes link-time errors when
building for wasm targets because the wasm linker is aware of function return
types and errors out if they differ between definition and declaration.
@khvzak
Copy link
Member

khvzak commented Dec 13, 2023

Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants