Building a dll with mingw & no_std I can't override DllMainCRTStartup.
msvc exports _DllMainCRTStartup so this works with
#[no_mangle]
extern "system" fn _DllMainCRTStartup(_: *const u8, _: u32, _: *const u8) -> u32 { 1 }
mingw exports DllMainCRTStartup but overriding this with similar code doesn't because of multiple definitions.
#[no_mangle]
extern "system" fn DllMainCRTStartup(_: *const u8, _: u32, _: *const u8) -> u32 { 1 }
= note: "x86_64-w64-mingw32-gcc" "-Wl,/tmp/rustcShm09B/list.def" "-fno-use-linker-plugin" "-Wl,--dynamicbase" "-Wl,--disable-auto-image-base" "-m64" "-Wl,--high-entropy-va" "/home/behemoth/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsbegin.o" "/tmp/rustcShm09B/symbols.o" "/[...]/target/x86_64-pc-windows-gnu/release/deps/libdec.libdec.b6b40ea1-cgu.0.rcgu.o" "-L" "/[...]/target/x86_64-pc-windows-gnu/release/deps" "-L" "/[...]/target/release/deps" "-L" "/home/behemoth/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib" "-Wl,-Bstatic" "/home/behemoth/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/libcompiler_builtins-50eb72b9dd1763b8.rlib" "-Wl,-Bdynamic" "-lgcc_eh" "-l:libpthread.a" "-lmsvcrt" "-lmingwex" "-lmingw32" "-lgcc" "-lmsvcrt" "-luser32" "-lkernel32" "-Wl,--nxcompat" "-L" "/home/behemoth/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib" "-o" "/[...]/target/x86_64-pc-windows-gnu/release/deps/libdec.dll" "-Wl,--gc-sections" "-shared" "-Wl,--out-implib=/[...]/target/x86_64-pc-windows-gnu/release/deps/liblibdec.dll.a" "-nodefaultlibs" "/home/behemoth/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-pc-windows-gnu/lib/rsend.o"
= note: /usr/lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld: /[...]/target/x86_64-pc-windows-gnu/release/deps/libdec.libdec.b6b40ea1-cgu.0.rcgu.o:libdec.b6b40ea1-cg:(.text+0x0): multiple definition of `DllMainCRTStartup'; /usr/lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/lib/../lib/dllcrt2.o:/build/mingw-w64-crt/src/mingw-w64-v10.0.0/mingw-w64-crt/crt/crtdll.c:148: first defined here
collect2: error: ld returned 1 exit status
Couldn't find anything helpful so far. Maybe I could force the linker to not consider dllcrt2 at all?