Any update on this patch ?
On Dekstop it's better to use kernel32.dll as it's loaded with every
process, so the LoadLibrary is not loading any new DLL.
On Winstore/UWP apps you cannot use LoadLibrary, only LoadLibraryFromApp
which cannot be used to load system DLLs. Static linking in necessary in
this case. Any app targeting UWP is already using the windowsapp.lib
(replacing the kernel32 lib they used to link with) so no need to fore
linking with it via pkg-config, libtool, etc.
For example in CLang you either link with windowsapp or kernel32:
https://github.com/llvm-project/clang/blob/master/lib/Driver/ToolChains/MinGW.cpp#L269
On 2020-05-19 8:24, Steve Lhomme wrote:
LoadLibrary is forbidden in such apps (can only load DLLs from within the app
package).
The API entries are available to all apps linking with the Windows API as found
here:
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis
windowsapp.lib (and mincore.lib for Windows 8) are both available in MinGW as
well.
GetSystemTimePreciseAsFileTime is only allowed in Win10 UWP apps.
---
lib/gettimeofday.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index 19804793a..087f7eada 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -45,12 +45,17 @@ static BOOL initialized = FALSE;
static void
initialize (void)
{
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && _WIN32_WINNT >=
0x0A00 /* _WIN32_WINNT_WIN10 */
+ /* LoadLibrary not allowed but the functions are available with the windows
runtime */
+ GetSystemTimePreciseAsFileTimeFunc = GetSystemTimePreciseAsFileTime;
+#else /* WINAPI_PARTITION_DESKTOP */
HMODULE kernel32 = LoadLibrary ("kernel32.dll");
if (kernel32 != NULL)
{
GetSystemTimePreciseAsFileTimeFunc =
(GetSystemTimePreciseAsFileTimeFuncType) GetProcAddress (kernel32,
"GetSystemTimePreciseAsFileTime");
}
+#endif /* WINAPI_PARTITION_DESKTOP */
initialized = TRUE;
}
--
2.26.2