https://bugs.winehq.org/show_bug.cgi?id=45864
Bug ID: 45864 Summary: wine mono cannot load 64-bit DLLs Product: Wine Version: 3.0.2 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: mscoree Assignee: wine-bugs@winehq.org Reporter: paleozogt@gmail.com Distribution: ---
Created attachment 62358 --> https://bugs.winehq.org/attachment.cgi?id=62358 wine mono project and binaries
Attached is an example project that makes a PInvoke call to a custom native function. It produces HelloWorld.exe (from HelloWorld.cs) and HelloWorld.dll (from HelloworldNative.cpp).
If I build a 32-bit HelloWorld.dll, I am able to run HelloWorld.exe in Wine with a WINEPREFIX generated from both WINEARCH=wine32 and WINEARCH=wine64.
However, if I build a 64-bit HelloWorld.dll, I am unable to run HelloWorld.exe in Wine with a WINEPREFIX generated from either WINEARCH=wine32 or WINEARCH=wine64. I wouldn't expect WINEARCH=wine32 to work for a 64-bit DLL, but its surprising that WINEARCH=wine64 doesn't work. (With WINEARCH=wine64 I'm otherwise able to run 64-bit native executables without a problem.)
The failure looks like this:
HelloWorld.exe
002f:err:mscoree:LoadLibraryShim error reading registry key for installroot
Unhandled Exception: System.DllNotFoundException: HelloWorld at (wrapper managed-to-native) HelloWorld.Hello:helloWorld () at HelloWorld.Hello.Main () [0x00001] in <93c08d3d3d384696aa77bc80f6a731c1>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: HelloWorld at (wrapper managed-to-native) HelloWorld.Hello:helloWorld () at HelloWorld.Hello.Main () [0x00001] in <93c08d3d3d384696aa77bc80f6a731c1>:0
It seems like Wine Mono is either running as a 32-bit process or something is wrong with how Wine Mono's PInvoke DllImport searches for compatible DLLs.