Closed

Description
Code
I tried this code:
[lib]
crate_type = ["cdylib"]
#[no_mangle]
extern "system" fn DllMain(module: HINSTANCE, reason: u32, _reserved: *mut c_void) -> i32 {
if reason == DLL_PROCESS_ATTACH {
unsafe {
DisableThreadLibraryCalls(module);
}
thread::spawn(move || unsafe { dll_attach() });
return 1;
}
return 0;
}
error: linking with `link.exe` failed: exit code: 1120
symbols.o : error LNK2001: unresolved external symbol _DllMain
Hint on symbols that are defined and could potentially match:
_DllMain@12
C:\Users\random\Desktop\project\target\i686-pc-windows-msvc\debug\deps\test.dll : fatal error LNK1120: 1 unresolved externals
It seems like #[no_mangle]
is not working anymore.
Version it worked on
rustc --version --verbose
:
rustc 1.62.0-nightly (18f314e70 2022-04-24)
binary: rustc
commit-hash: 18f314e7027fe7084aaab8620c624a0d7bd29e70
commit-date: 2022-04-24
host: x86_64-pc-windows-msvc
release: 1.62.0-nightly
LLVM version: 14.0.1
Version with regression
rustc --version --verbose
:
rustc 1.62.0-nightly (055bf4ccd 2022-04-25)
binary: rustc
commit-hash: 055bf4ccd521c2c2185166c86951be7be145727c
commit-date: 2022-04-25
host: x86_64-pc-windows-msvc
release: 1.62.0-nightly
LLVM version: 14.0.1