jcmoyer / rust-lua53

Lua 5.3 bindings for Rust
MIT License
158 stars 45 forks source link

Compiling a dll on stable-x86_64-pc-windows-gnu fails to link functions correctly #87

Open bpglaser opened 7 years ago

bpglaser commented 7 years ago

When compiling a dll via cargo targeting stable-x86_64-pc-windows-gnu the linker fails to include the correct functions. Instead it only links lua funcitons in the dll.

I came across this when trying to compile the as-lua-lib example. The resultant dll only contains functions prefixed with "lua", "luaL", or "luaopen_". Notably missing is the "luaopen_mathx" function required for requiring the library from lua.

I can confirm that the same setup does indeed correctly link when the lua crate is omitted from the compilation. Likewise, the functions are included when compiling with the stable-x86_64-pc-windows-msvc target.

gist example

retep998 commented 7 years ago

What happens if you change crate-type = ["dylib"] to crate-type = ["cdylib"]?

bpglaser commented 7 years ago

@retep998 I fear that compiling with the cdylib crate-type yields the same result