changeset 25524:366d4b8f6668

Fix loading of shared libraries from paths with non-ASCII chars on Windows (bug #49118). * oct-shlib.cc (octave_w32_shlib): Use Windows wide character API functions.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 29 Jun 2018 22:23:49 +0200
parents 90c8325c14be
children 48a9bd2d0a20
files liboctave/util/oct-shlib.cc
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/oct-shlib.cc	Fri Jun 29 11:25:02 2018 -0700
+++ b/liboctave/util/oct-shlib.cc	Fri Jun 29 22:23:49 2018 +0200
@@ -62,6 +62,10 @@
 #include "oct-shlib.h"
 #include "str-vec.h"
 
+#if defined (HAVE_LOADLIBRARY_API)
+#  include "lo-sysdep.h"
+#endif
+
 namespace octave
 {
   dynamic_library::dynlib_rep::dynlib_rep (const std::string& f)
@@ -371,7 +375,8 @@
   static void
   set_dll_directory (const std::string& dir = "")
   {
-    SetDllDirectory (dir.empty () ? nullptr : dir.c_str ());
+    SetDllDirectoryW (dir.empty () ? nullptr
+                                   : sys::u8_to_wstring (dir).c_str ());
   }
 
   octave_w32_shlib::octave_w32_shlib (const std::string& f)
@@ -387,7 +392,7 @@
 
     set_dll_directory (dir);
 
-    handle = LoadLibrary (file.c_str ());
+    handle = LoadLibraryW (sys::u8_to_wstring (file).c_str ());
 
     set_dll_directory ();