[vlc-devel] [PATCH 2/3] win32: use vlc_load_syslib() instead of LoadLibrary for system DLLs

Rémi Denis-Courmont remi at remlab.net
Fri Mar 10 18:43:34 CET 2017


Le torstaina 9. maaliskuuta 2017, 16.02.36 EET Steve Lhomme a écrit :
> ---
>  modules/audio_output/directsound.c               |  5 ++-
>  modules/codec/avcodec/d3d11va.c                  |  4 +-
>  modules/codec/avcodec/directx_va.c               |  3 +-
>  modules/codec/avcodec/directx_va.h               |  2 +-
>  modules/codec/avcodec/dxva2.c                    |  2 +-
>  modules/codec/dmo/dmo.c                          | 49
> ++++++++++++------------ modules/codec/mft.c                              |
>  3 +-
>  modules/gui/qt/components/simple_preferences.cpp |  2 +-
>  modules/text_renderer/freetype/fonts/dwrite.cpp  |  3 +-
>  modules/video_output/win32/common.c              |  3 +-
>  modules/video_output/win32/direct3d11.c          | 11 +++---
>  modules/video_output/win32/direct3d9.c           | 10 ++---
>  modules/video_output/win32/directdraw.c          |  6 +--
>  13 files changed, 55 insertions(+), 48 deletions(-)

Do we actually need run-time loading in any of those? I bet most if not all of 
them don´t.

Run-time loading DirectSound is hysterical raisins from Win9x support and not 
setting the Win32 error mode. Back then a missing DLL in a plugin would 
terminate the process. Nowadays, a plugin that depends on a missing DLL just 
won´t get loaded. So unless the DLL is entirely optional to the plugin 
functionality, you should link it at build-time, and enjoy type safety and 
missing symbols detection.

In the corner case that an optional function is only available in some 
versions of the DLL, GetModuleHandle() should be used instead of 
LoadLibrary().

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list