This allows loading libraries from arbitrary, non-ascii paths.
---
 configure                |  6 +++---
 libavutil/dyn_lib_open.h | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index a7671b7..ed32341 100755
--- a/configure
+++ b/configure
@@ -1573,7 +1573,7 @@ SYSTEM_FUNCS="
     inet_aton
     isatty
     jack_port_get_latency_range
-    LoadLibrary
+    LoadLibraryW
     localtime_r
     mach_absolute_time
     MapViewOfFile
@@ -4478,7 +4478,7 @@ check_func_headers windows.h CoTaskMemFree -lole32
 check_func_headers windows.h GetProcessAffinityMask
 check_func_headers windows.h GetProcessTimes
 check_func_headers windows.h GetSystemTimeAsFileTime
-check_func_headers windows.h LoadLibrary
+check_func_headers windows.h LoadLibraryW
 check_func_headers windows.h MapViewOfFile
 check_func_headers windows.h SetConsoleTextAttribute
 check_func_headers windows.h Sleep
@@ -4568,7 +4568,7 @@ done
 
 # This needs to be evaluated here instead of via the generic mechanism
 # (setting dyn_lib_open_deps_any) since we want it set here
-enabled_any dlopen LoadLibrary && enable dyn_lib_open || disable dyn_lib_open
+enabled_any dlopen LoadLibraryW && enable dyn_lib_open || disable dyn_lib_open
 
 # these are off by default, so fail if requested and not available
 enabled avisynth          && { { check_header "avisynth/avisynth_c.h" && 
enabled dyn_lib_open; } ||
diff --git a/libavutil/dyn_lib_open.h b/libavutil/dyn_lib_open.h
index d69d169..c81646c 100644
--- a/libavutil/dyn_lib_open.h
+++ b/libavutil/dyn_lib_open.h
@@ -21,10 +21,25 @@
 
 #include "config.h"
 
-#if HAVE_LOADLIBRARY
+#if HAVE_LOADLIBRARYW
 #include <windows.h>
+#include "wchar_filename.h"
+
+static void* load_library(const char *filename_utf8)
+{
+    wchar_t *filename_w;
+    void *ret;
+
+    if (utf8towchar(filename_utf8, &filename_w))
+        return NULL;
+    /* Not trying to fall back to ACP */
+    if (!filename_w)
+        return NULL;
+    ret = LoadLibraryW(filename_w);
+    av_free(filename_w);
+    return ret;
+}
 
-#define load_library LoadLibrary
 #define get_function GetProcAddress
 #define free_library FreeLibrary
 
-- 
2.7.4 (Apple Git-66)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to