# HG changeset patch # User John W. Eaton # Date 1455043045 18000 # Node ID 5d23ea5c733ad0b41b02e11c5c1d99b1f14a766b # Parent 20a824cd1d9e47f64a38d1181357b102ce894ada 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. diff -r 20a824cd1d9e -r 5d23ea5c733a liboctave/util/lo-cutils.c --- 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 - -/* 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) { diff -r 20a824cd1d9e -r 5d23ea5c733a liboctave/util/lo-cutils.h --- 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 -#ifdef HAVE_LOADLIBRARY_API -# define WIN32_LEAN_AND_MEAN 1 -# include -#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); diff -r 20a824cd1d9e -r 5d23ea5c733a liboctave/util/oct-shlib.cc --- 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 (GetProcAddress (handle, sym_name.c_str ())); return function; }