[FFmpeg-devel] [PATCH] compat: LoadLibrary isn't available on UWP/WinRT
Aaron Levinson
alevinsn at aracnet.com
Sat Jun 3 20:54:08 EEST 2017
On 6/2/2017 7:11 AM, wm4 wrote:
> On Fri, 2 Jun 2017 15:29:07 +0200
> Hugo Beauzée-Luyssen <hugo at beauzee.fr> wrote:
>
>> ---
>> compat/w32dlfcn.h | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/compat/w32dlfcn.h b/compat/w32dlfcn.h
>> index bc9bb8c9f5..308763be53 100644
>> --- a/compat/w32dlfcn.h
>> +++ b/compat/w32dlfcn.h
>> @@ -71,7 +71,11 @@ exit:
>> #ifndef LOAD_LIBRARY_SEARCH_SYSTEM32
>> # define LOAD_LIBRARY_SEARCH_SYSTEM32 0x00000800
>> #endif
>> +#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
>> return LoadLibraryExA(name, NULL, LOAD_LIBRARY_SEARCH_APPLICATION_DIR | LOAD_LIBRARY_SEARCH_SYSTEM32);
>> +#else
>> + return NULL;
>> +#endif
>> }
>> #define dlopen(name, flags) win32_dlopen(name)
>> #define dlclose FreeLibrary
>
> Isn't it that LoadLibraryW is available, just not the A version?
According to
https://msdn.microsoft.com/en-us/library/windows/apps/mt654039.aspx#_api-ms-win-core-libraryloader-l1-2-0.dll
, both the A and W versions of LoadLibrary and LoadLibraryEx would seem
to be available on UWP. However, at the same time, I don't see any of
the LoadLibrary APIs listed at either
https://msdn.microsoft.com/en-us/library/windows/apps/dn424765.aspx ,
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-apis , or
https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-extension-apis
, so perhaps LoadLibrary and LoadLibraryEx aren't supported. So, there
appears to be some conflicting information on MSDN. According to
https://msdn.microsoft.com/en-us/library/mt186162.aspx , it is necessary
to use LoadPackagedLibrary in UWP apps instead of LoadLibrary or
LoadLibraryEx.
According to the article, "These macros are only available in Windows
SDK 8.1 and later, so if your code needs to compile with earlier
versions of the Windows SDK or for other platforms besides Windows, then
you should also consider the case that none of them are defined." I'm
not aware of ffmpeg necessarily having a requirement that it be built
with the Windows 8.1 SDK or later, and this lack of requirement would
tend to indicate that the proposed patch isn't sufficient. Plus, there
is no reason to #define LOAD_LIBRARY_SEARCH_SYSTEM32 if the code won't
be built anyway.
Aaron Levinson
More information about the ffmpeg-devel
mailing list