changeset 21236:5d23ea5c733a

eliminate configuration macros from lo-cutils.h * lo-cutils.h, lo-cutils.c (octave_w32_library_search): Delete. Don't include windows.h * oct-shlib.cc: (octave_w32_library_search): Delete extern decl. (octave_w32_shlib::octave_w32_shlib): Declare msg as const char*. (octave_w32_shlib::search): Call GetProcAddress directly.
author John W. Eaton <jwe@octave.org>
date Tue, 09 Feb 2016 13:37:25 -0500
parents 20a824cd1d9e
children ffc9806bb300
files liboctave/util/lo-cutils.c liboctave/util/lo-cutils.h liboctave/util/oct-shlib.cc
diffstat 3 files changed, 4 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/util/lo-cutils.c	Tue Feb 09 10:35:28 2016 -0800
+++ b/liboctave/util/lo-cutils.c	Tue Feb 09 13:37:25 2016 -0500
@@ -62,17 +62,6 @@
   return strncasecmp (s1, s2, n);
 }
 
-#ifdef HAVE_LOADLIBRARY_API
-#  include <windows.h>
-
-/* Need this since in C++ can't cast from int(*)() to void* */
-OCTAVE_API void *
-octave_w32_library_search (HINSTANCE handle, const char * name)
-{
-  return (GetProcAddress (handle, name));
-}
-#endif
-
 OCTAVE_API pid_t
 octave_waitpid (pid_t pid, int *status, int options)
 {
--- a/liboctave/util/lo-cutils.h	Tue Feb 09 10:35:28 2016 -0800
+++ b/liboctave/util/lo-cutils.h	Tue Feb 09 13:37:25 2016 -0500
@@ -25,11 +25,6 @@
 
 #include <sys/types.h>
 
-#ifdef HAVE_LOADLIBRARY_API
-#  define WIN32_LEAN_AND_MEAN 1
-#  include <windows.h>
-#endif
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -44,11 +39,6 @@
 OCTAVE_API int
 octave_strncasecmp (const char *s1, const char *s2, size_t n);
 
-#ifdef HAVE_LOADLIBRARY_API
-OCTAVE_API void *
-octave_w32_library_search (HINSTANCE handle, const char *name);
-#endif
-
 OCTAVE_API pid_t
 octave_waitpid (pid_t pid, int *status, int options);
 
--- a/liboctave/util/oct-shlib.cc	Tue Feb 09 10:35:28 2016 -0800
+++ b/liboctave/util/oct-shlib.cc	Tue Feb 09 13:37:25 2016 -0500
@@ -345,17 +345,17 @@
   if (! handle)
     {
       DWORD lastError = GetLastError ();
-      char *msg;
+      const char *msg;
 
       switch (lastError)
         {
         case ERROR_MOD_NOT_FOUND:
         case ERROR_DLL_NOT_FOUND:
-          msg = "could not find library or dependents";
+          msg = "could not find library or dependencies";
           break;
 
         case ERROR_INVALID_DLL:
-          msg = "library or its dependents are damaged";
+          msg = "library or its dependencies are damaged";
           break;
 
         case ERROR_DLL_INIT_FAILED:
@@ -376,11 +376,6 @@
     FreeLibrary (handle);
 }
 
-extern "C"
-{
-  void * octave_w32_search (HINSTANCE handle, const char * name);
-}
-
 void *
 octave_w32_shlib::search (const std::string& name,
                           octave_shlib::name_mangler mangler)
@@ -396,7 +391,7 @@
   if (mangler)
     sym_name = mangler (name);
 
-  function = octave_w32_library_search (handle, sym_name.c_str ());
+  function = reinterpret_cast <void *> (GetProcAddress (handle, sym_name.c_str ()));
 
   return function;
 }