Skip to content
This repository has been archived by the owner on Nov 1, 2020. It is now read-only.

Windows DLL import leftovers in Unix assemblies? #8254

Open
RalfKornmannEnvision opened this issue Aug 5, 2020 · 3 comments
Open

Windows DLL import leftovers in Unix assemblies? #8254

RalfKornmannEnvision opened this issue Aug 5, 2020 · 3 comments

Comments

@RalfKornmannEnvision
Copy link
Contributor

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
Copy link
Member

jkotas commented Aug 5, 2020

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

@jkotas jkotas closed this as completed Aug 5, 2020
@jkotas jkotas reopened this Aug 5, 2020
@jkotas
Copy link
Member

jkotas commented Aug 5, 2020

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
Copy link
Contributor Author

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

JoshuaWierenga added a commit to JoshuaWierenga/EfiSharp that referenced this issue Oct 25, 2020
Ignoring the almost guaranteed issues when building, this has most corelib files included but I ran into issues with the recent globalization changes and using kernel32 functions. dotnet/corert#8254 suggests that kernel32 library calls might be stripped out for non windows builds so this might have been fine.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants