Community
cancel
Showing results for 
Search instead for 
Did you mean: 
299 Views

OneCore aka Universal Windows Driver compatibility

Hi.

I want to build a simple "int main(){ return 0; }" program that passes the API Validator OneCore compatibility test.

After reading https://msdn.microsoft.com/en-us/windows/hardware/drivers/develop/getting-started-with-universal-dri... and https://msdn.microsoft.com/en-us/library/windows/desktop/mt654040(v=vs.85).aspx I proceeded to build a simple default solution in VS2015 u3 on my Windows 10 build 14393 system with the program described above.

If my platform toolset is "WindowsApplicationForDrivers10.0" or even "Visual Studio 2015 (v140)", running the API Validator that comes with the Windows SDK as a post-build event succeeds:

"C:\Program Files (x86)\Windows Kits\10\bin\x64\apivalidator.exe"  -driverpackagepath:"$(OutDir)\" -SupportedApiXmlFiles:"C:\Program Files (x86)\Windows Kits\10\build\universalDDIs\$(Platform)\UniversalDDIs.xml" -ModuleWhiteListXmlFiles:"C:\Program Files (x86)\Windows Kits\10\build\universalDDIs\$(Platform)\ModuleWhiteList.xml"

If I switch the Platform Toolset to Intel C++ Compiler 17.0 u2, I get warnings that my executable now has a dynamic dependency on ntdll.dll, which is not OneCore compliant. According to my investigations, this is because libirc.lib was linked with a dependency on ntlib.lib and the warnings appear for printf, vsnprintf, scanf, and variations of those functions.

Is it possible to generate a libirc.lib such that it ignores these default dependencies? This would allow the person building the executable or dll to choose the OneCore umbrella library (OneCore.lib) or the traditional desktop library (ntdll.lib) as the means to resolve those dependencies instead of having that decision being made in the libirc.lib.

Thank you.

0 Kudos
4 Replies
SergeyKostrov
Valued Contributor II
299 Views

>>...I get warnings that my executable now has a dynamic dependency on ntdll.dll... Your executable has that dependency because basic initializations for a Windows application need to be completed anyway. If they are Not done the application won't work. My question is what problems do you have with that dependency? >>...Is it possible to generate a libirc.lib such that it ignores these default dependencies? You could try No Default Libraries option but there is no guarantee that it will solve your "problem". If you need an executable with minimal dependencies try to use MinGW C++ compiler for Windows.
299 Views

>My question is what problems do you have with that dependency?

This dependency makes the resulting executable get a warning when running the API validator. I want to not have that warning. Adding

  /NODEFAULTLIB:"ntlib.lib"

to the executable build doesn't change that because libirc.lib already indicated it would use ntdll.lib and its corresponding ntdll.dll.

I want OneCoreUap.lib to be used so that they symbol is resolved in api-ms-win-crt-stdio-l1-1-0.dll.

I am not sure switching to MinGW C++ compiler will help, I can try. But even if it worked, I want to use the Intel Compiler in my product.

Thanks

SergeyKostrov
Valued Contributor II
299 Views

>>...I am not sure switching to MinGW C++ compiler will help, I can try... I did a simple verification and for a small test case compiled with MinGW C++ compiler version 6.1.0 there are two dependent DLLs: kernel32.dll msvcrt.dll
299 Views

Another way to state it is that the linker directives below should not have default libraries. Instead it should be left to whoever is building the .exe or .dll to select the libraries needed

OR

A different libirc.lib that is specific for OneCore systems should be built, and that version uses OneCore.lib and ignores the other libs listed below.

> dumpbin /directives libirc.lib
Microsoft (R) COFF/PE Dumper Version 14.00.24215.1
Copyright (C) Microsoft Corporation.  All rights reserved.


Dump of file libirc.lib

File Type: LIBRARY

   Linker Directives
   -----------------
   -defaultlib:uuid.lib
   -defaultlib:uuid.lib

   Linker Directives
   -----------------
   -defaultlib:uuid.lib
   -defaultlib:uuid.lib
   -defaultlib:kernel32.lib

   Linker Directives
   -----------------
   -defaultlib:uuid.lib
   -defaultlib:uuid.lib
   -defaultlib:kernel32.lib
   -defaultlib:ImageHlp

   Linker Directives
   -----------------
   -defaultlib:uuid.lib
   -defaultlib:uuid.lib
   -defaultlib:kernel32.lib

   Linker Directives
   -----------------
   -defaultlib:uuid.lib
   -defaultlib:uuid.lib
   -defaultlib:kernel32.lib

Reply