-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
#[link(kind="raw-dylib")] mis-compiles if cdylib export has the same name #113050
Copy link
Copy link
Open
Open
Copy link
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.F-raw_dylib`#![feature(raw_dylib)]``#![feature(raw_dylib)]`O-windowsOperating system: WindowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-linkageArea: linking into static, shared libraries and binariesArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.Category: This is a bug.F-raw_dylib`#![feature(raw_dylib)]``#![feature(raw_dylib)]`O-windowsOperating system: WindowsOperating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
When importing a function via
raw-dylib, if an exported function has the same name, the compiler will use the exported version in all cases.I would expect my exported
MessageBoxAfunction to compile to ajmpor acallto the one imported via IAT.Instead, in Debug mode it compiles to a call of my function, and in Release mode, an infinite loop (x64 assembly
eb fe: jmp 0x0).The DLL does not even have an IAT entry for
user32.dll.If I name my function
my_MessageBoxAand then rename it using a.deffile during linking, the behaviour is as expected.Meta
rustc --version --verbose:Relates to: #58713