You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to use bindgen.
When targeting i686-pc-windows-msvc on 64-bit windows host, I noticed that the generated function symbol is mangled even if the link_name attribute is specified. Bindgen already mangles the function and passes it as a value to the link_name attribute, so the function is mangled twice (which is wrong and produce a link error).
But when I use it, I get the following linker error: error LNK2019: unresolved external symbol __foo@0@0 referenced in function...
As you can see, the function is mangled twice. If I remove the link_name attribute, it works.
The text was updated successfully, but these errors were encountered:
LLVM automatically performs calling convention decoration on symbols. This sounds like a simple case where bindgen should just not emit link_name, but if you really want to explicitly specify the calling convention decoration yourself then I believe prefixing the name with \x01 should tell LLVM to not automatically decorate symbols.
…ecified, r=emilio
Tell LLVM to not mangle names if they're already mangled
LLVM mangles the name by default but functions are already mangled because the `link_name` attribute's value is mangled.
Prefixing the name with `\u{1}` should tell LLVM to not mangle it.
I originally thought it's a bug in rustc, but it was clarified here: rust-lang/rust#45073
I'm trying to use bindgen.
When targeting
i686-pc-windows-msvc
on 64-bit windows host, I noticed that the generated function symbol is mangled even if thelink_name
attribute is specified. Bindgen already mangles the function and passes it as a value to thelink_name
attribute, so the function is mangled twice (which is wrong and produce a link error).For example, with the following header:
Bindgen will produce:
But when I use it, I get the following linker error:
error LNK2019: unresolved external symbol __foo@0@0 referenced in function
...As you can see, the function is mangled twice. If I remove the
link_name
attribute, it works.The text was updated successfully, but these errors were encountered: