From 41b62bc93717becd254ff62b8189196161b1032f Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Sun, 14 Oct 2012 23:55:36 +0300 Subject: [PATCH] Add a missing header file and correct win32 build error --- include/library/loadlib.hpp | 54 ++++++++++++++++++++++++ include/platform/wxwidgets/menu_dump.hpp | 1 + src/library/loadlib.cpp | 3 +- src/platform/wxwidgets/mainwindow.cpp | 15 +++---- src/platform/wxwidgets/messages.cpp | 4 +- 5 files changed, 66 insertions(+), 11 deletions(-) create mode 100644 include/library/loadlib.hpp diff --git a/include/library/loadlib.hpp b/include/library/loadlib.hpp new file mode 100644 index 00000000..6ba5a1c8 --- /dev/null +++ b/include/library/loadlib.hpp @@ -0,0 +1,54 @@ +#ifndef _library__loadlib__hpp__included__ +#define _library__loadlib__hpp__included__ + +#include +#include + +#if defined(_WIN32) || defined(_WIN64) +#include +#endif + +/** + * A loaded library. + */ +class loaded_library +{ +public: +/** + * Load a new library. + * + * Parameter filename: The name of file. + * Throws std::bad_alloc: Not enough memory. + * Throws std::runtime_error: Error loading shared library. + */ + loaded_library(const std::string& filename) throw(std::bad_alloc, std::runtime_error); +/** + * Unload a library. + */ + ~loaded_library() throw(); +/** + * Look up a symbol. + * + * Parameter symbol: The symbol to look up. + * Returns: The symbol value. + * Throws std::bad_alloc: Not enough memory. + * Throws std::runtime_error: Error looking up the symbol. + */ + void* operator[](const std::string& symbol) throw(std::bad_alloc, std::runtime_error); +/** + * See what libraries are called on this platform. + * + * Returns: The name of library. + */ + static const std::string& call_library() throw(); +private: + loaded_library(const loaded_library&); + loaded_library& operator=(const loaded_library&); +#if defined(_WIN32) || defined(_WIN64) + HMODULE handle; +#elif !defined(NO_DLFCN) + void* handle; +#endif +}; + +#endif diff --git a/include/platform/wxwidgets/menu_dump.hpp b/include/platform/wxwidgets/menu_dump.hpp index 8854f05c..7a6cc02f 100644 --- a/include/platform/wxwidgets/menu_dump.hpp +++ b/include/platform/wxwidgets/menu_dump.hpp @@ -3,6 +3,7 @@ #include #include +#include class dumper_menu_monitor; class dumper_info; diff --git a/src/library/loadlib.cpp b/src/library/loadlib.cpp index e7202bf2..3241f808 100644 --- a/src/library/loadlib.cpp +++ b/src/library/loadlib.cpp @@ -1,4 +1,5 @@ #include "library/loadlib.hpp" +#include #if !defined(NO_DLFCN) && !defined(_WIN32) && !defined(_WIN64) #include @@ -76,7 +77,7 @@ void* loaded_library::operator[](const std::string& symbol) throw(std::bad_alloc throw std::runtime_error(e); return NULL; //Yes, real NULL symbol. #elif defined(_WIN32) || defined(_WIN64) - void* s = GetProcAddress(handle, symbol.c_str()); + void* s = (void*)GetProcAddress(handle, symbol.c_str()); if(s) return s; int errcode = GetLastError(); diff --git a/src/platform/wxwidgets/mainwindow.cpp b/src/platform/wxwidgets/mainwindow.cpp index 127d5db6..2bbbab38 100644 --- a/src/platform/wxwidgets/mainwindow.cpp +++ b/src/platform/wxwidgets/mainwindow.cpp @@ -1,7 +1,13 @@ #include "lsnes.hpp" -#include "core/emucore.hpp" +#include +#include "platform/wxwidgets/menu_dump.hpp" +#include "platform/wxwidgets/platform.hpp" +#include "platform/wxwidgets/window_mainwindow.hpp" +#include "platform/wxwidgets/window_messages.hpp" +#include "platform/wxwidgets/window_status.hpp" +#include "core/emucore.hpp" #include "core/audioapi.hpp" #include "core/command.hpp" #include "core/controller.hpp" @@ -21,17 +27,10 @@ #include "library/string.hpp" #include "library/zip.hpp" -#include - #include #include #include -#include "platform/wxwidgets/menu_dump.hpp" -#include "platform/wxwidgets/platform.hpp" -#include "platform/wxwidgets/window_mainwindow.hpp" -#include "platform/wxwidgets/window_messages.hpp" -#include "platform/wxwidgets/window_status.hpp" extern "C" { diff --git a/src/platform/wxwidgets/messages.cpp b/src/platform/wxwidgets/messages.cpp index 2e324338..05794f02 100644 --- a/src/platform/wxwidgets/messages.cpp +++ b/src/platform/wxwidgets/messages.cpp @@ -1,8 +1,8 @@ -#include "core/window.hpp" - #include "platform/wxwidgets/window_messages.hpp" #include "platform/wxwidgets/platform.hpp" +#include "core/window.hpp" + #define MAXMESSAGES 20 wxwin_messages::panel::panel(wxwin_messages* _parent, unsigned lines)