dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 508 forks source link

Windows DLL import leftovers in Unix assemblies? #8254

Open RalfKornmannEnvision opened 4 years ago

RalfKornmannEnvision commented 4 years ago

To get an idea of how many and which native calls I need to implement on different game consoles I have written a small tool that scans assemblies for DLLImports. To my surprise I found some calls to Windows dlls in the SDK and framework folder that were build for an ARM64 Unix system. 

I assume it's not a big issue as these functions might not be called at all and as CoreRT would use dynamic loading they will not cause any unresolved externals. But maybe someone is interested and like to clean it up at some point

In System.Private.CoreLib.dll I found         kernel32.dll                 LCIDToLocaleName                 LocaleNameToLCID                 LCMapStringEx                 FindNLSStringEx                 CompareStringEx                 CompareStringOrdinal                 FindStringOrdinal                 IsNLSDefinedString                 GetUserPreferredUILanguages                 GetLocaleInfoEx                 EnumSystemLocalesEx                 EnumTimeFormatsEx                 GetCalendarInfoEx                 GetUserGeoID                 GetGeoInfo                 EnumCalendarInfoExEx                 GetNLSVersionEx                 ResolveLocaleName         Normaliz.dll                 IdnToAscii                 IdnToUnicode                 IsNormalizedString                 NormalizeString

and another one in System.Reflection.Metadata.dll         kernel32.dll                 ReadFile

jkotas commented 4 years ago

This list suggests that the System.Private.CoreLib is not actually built for Unix.

jkotas commented 4 years ago

Ah ... I forgot about the recent globalization changes. All kernel32.dll functions in the list are unreachable on Unix. We depend on the compiler or IL linker to strip them out.

RalfKornmannEnvision commented 4 years ago

If it is supposed to work this way ignore my ramblings about it.