rust-lua53 icon indicating copy to clipboard operation
rust-lua53 copied to clipboard

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

Open bpglaser opened this issue 7 years ago • 2 comments

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

bpglaser avatar Jul 04 '17 12:07 bpglaser

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

retep998 avatar Jul 08 '17 05:07 retep998

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

bpglaser avatar Jul 08 '17 12:07 bpglaser