From a7fc644043dd798f5bd95b1bdbfc694a6fac020e Mon Sep 17 00:00:00 2001 From: tchernobog Date: Mon, 7 Aug 2006 15:16:27 +0000 Subject: [PATCH] - Fix compilation and loading of XmlSave plugin - Fix throwing of exceptions from sgpem::Module - **THOU SHALL ALWAYS UPDATE THY MAKEFILES, OR THE WRATH OF GOD WILL DESCEND UPON THEE** git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@827 3ecf2c5c-341e-0410-92b4-d18e462d057c --- Makefile.am | 4 ++++ src/backend/module.cc | 2 ++ src/backend/plugin_manager.cc | 16 +++------------- src/backend/serialize_visitor.hh | 2 +- src/backend/serializer.cc | 2 ++ src/backend/serializer.hh | 2 +- src/backend/serializer_error.hh | 2 +- 7 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Makefile.am b/Makefile.am index d6cea4d..6a9f99c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -181,6 +181,8 @@ src_backend_libbackend_la_SOURCES = \ src/backend/schedulable.cc \ src/backend/scheduler.cc \ src/backend/serialize_visitor.cc \ + src/backend/serializer.cc \ + src/backend/serializer_error.cc \ src/backend/serializers_gatekeeper.cc \ src/backend/simulation.cc \ src/backend/static_process.cc \ @@ -223,6 +225,8 @@ pkginclude_HEADERS += \ src/backend/schedulable.hh \ src/backend/scheduler.hh \ src/backend/serialize_visitor.hh \ + src/backend/serializer.hh \ + src/backend/serializer_error.hh \ src/backend/serializers_gatekeeper.hh \ src/backend/simulation.hh \ src/backend/sub_request.hh \ diff --git a/src/backend/module.cc b/src/backend/module.cc index 7c93f50..bb53e50 100644 --- a/src/backend/module.cc +++ b/src/backend/module.cc @@ -35,6 +35,8 @@ Module::Module(const Glib::ustring& identifier) throw(InvalidPluginException) : get_author_ptr(NULL), get_version_ptr(NULL) { + if(!*this) throw InvalidPluginException(Module::get_last_error()); + // Type-safeness here is an optional, as always. :-) std::string prefix = "sgpem__Plugin__"; if(!(get_symbol(prefix + "on_init", (void*&) on_init_ptr) && diff --git a/src/backend/plugin_manager.cc b/src/backend/plugin_manager.cc index c7b79ec..834e877 100644 --- a/src/backend/plugin_manager.cc +++ b/src/backend/plugin_manager.cc @@ -70,23 +70,13 @@ PluginManager::rescan_dirs() { std::string module_path = Module::build_path(*it, *dir_it); - std::cout << "Attempting to load module at path " << module_path << std::endl; + std::cerr << "Attempting to load module at path " << module_path << std::endl; try { module = new Module(module_path); - - if(*module) - { - _modules.push_back(module); - std::cerr << "\tSuccess" << std::endl; - } - else - { - std::cerr << "\tFailed: " << Glib::Module::get_last_error() << std::endl; - delete module; - } - + _modules.push_back(module); + std::cerr << "\tSuccess" << std::endl; } catch(InvalidPluginException e) { diff --git a/src/backend/serialize_visitor.hh b/src/backend/serialize_visitor.hh index 02f4a54..23380cf 100644 --- a/src/backend/serialize_visitor.hh +++ b/src/backend/serialize_visitor.hh @@ -48,7 +48,7 @@ namespace sgpem This class is a virtual class and each method must be reimplemented in derived classes to have effective serialization. */ - class SerializeVisitor + class SG_DLLEXPORT SerializeVisitor { public: virtual ~SerializeVisitor() = 0; diff --git a/src/backend/serializer.cc b/src/backend/serializer.cc index 82037b3..656b487 100644 --- a/src/backend/serializer.cc +++ b/src/backend/serializer.cc @@ -20,6 +20,8 @@ #include "serializer.hh" +#include "serializers_gatekeeper.hh" + using namespace sgpem; Serializer::Serializer() diff --git a/src/backend/serializer.hh b/src/backend/serializer.hh index be97132..96356c3 100644 --- a/src/backend/serializer.hh +++ b/src/backend/serializer.hh @@ -31,7 +31,7 @@ namespace sgpem { class Serializer; - class Serializer + class SG_DLLEXPORT Serializer { public: Serializer(); diff --git a/src/backend/serializer_error.hh b/src/backend/serializer_error.hh index 9dc4cfe..63824d9 100644 --- a/src/backend/serializer_error.hh +++ b/src/backend/serializer_error.hh @@ -27,7 +27,7 @@ namespace sgpem { - class SerializerError : public std::runtime_error + class SG_DLLEXPORT SerializerError : public std::runtime_error { public: SerializerError(const std::string& what);