[FFmpeg-devel] [PATCH] lavf/os_support: Add safe win32 dlopen/dlclose/dlsym functions.
James Almer
jamrial at gmail.com
Mon Aug 29 18:46:59 EEST 2016
On 8/29/2016 3:49 AM, Matt Oliver wrote:
> From 7c70764508643c45b037f1ed9d77a95c24b05f6e Mon Sep 17 00:00:00 2001
> From: Matt Oliver <protogonoi at gmail.com>
> Date: Mon, 29 Aug 2016 16:46:10 +1000
> Subject: [PATCH 2/2] Modify existing dll loading to use new safe dlopen.
>
> ---
> libavcodec/nvenc.c | 9 ++-------
> libavformat/avisynth.c | 13 ++++---------
> libavutil/hwcontext_dxva2.c | 16 ++++++++--------
> 3 files changed, 14 insertions(+), 24 deletions(-)
>
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 283f29f..f94a930 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -33,16 +33,11 @@
> # define NVENC_LIBNAME "libnvidia-encode.so.1"
> #endif
>
> -#if defined(_WIN32)
> -#include <windows.h>
> -
> -#define dlopen(filename, flags) LoadLibrary(TEXT(filename))
> -#define dlsym(handle, symbol) GetProcAddress(handle, symbol)
> -#define dlclose(handle) FreeLibrary(handle)
> -#else
> +#if !defined(_WIN32)
> #include <dlfcn.h>
> #endif
>
> +#include "libavformat/os_support.h"
FYI, last time i tried to include this file from libavcodec i was told
not to since it's libavformat specific.
The proper place for these wrappers is probably the compat folder, in
a new file similar to w32threads.h
> #include "libavutil/hwcontext.h"
> #include "libavutil/imgutils.h"
> #include "libavutil/avassert.h"
More information about the ffmpeg-devel
mailing list