4
* Copyright (C) 2010 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See the
8
* COPYING file in the root project directory for full text.
13
* @brief Module Definitions
20
#include <ScaleStack/Module.h>
21
#include <ScaleStack/Kernel.h>
26
Module::Module(const std::string& name_arg):
46
const std::string& Module::getName(void) const
51
const std::string& Module::getPathname(void) const
56
const std::string& Module::getCanonicalName(void) const
58
return canonical_name;
61
const std::string& Module::getVersion(void) const
66
const std::string& Module::getAuthor(void) const
71
const std::string& Module::getTitle(void) const
76
const std::string& Module::getLicense(void) const
81
const std::vector<std::string>& Module::getDependencies(void) const
86
bool Module::checkName(const std::string& check_name) const
88
return name == check_name || canonical_name == check_name;
91
void Module::load(void)
96
pathname = "ScaleStack/.libs/" + name + ".so";
97
handle = dlopen(pathname.c_str(), RTLD_NOW | RTLD_GLOBAL);
101
definition = static_cast<Module::Definition*>(dlsym(handle, "_scalestack_definition"));
102
if (definition == NULL)
105
canonical_name = definition->name;
106
version = definition->version;
107
author = definition->author;
108
title = definition->title;
109
license = definition->license;
111
for (const char** dependency = definition->dependencies;
115
dependencies.push_back(*dependency);
118
definition->options();
121
void Module::unload(void)
126
if (dlclose(handle) != 0)
127
throw DLCloseFailed();
133
ScaleStackExceptionMessage(DLOpenFailed, dlerror())
134
ScaleStackExceptionMessage(DLSymFailed, dlerror())
135
ScaleStackExceptionMessage(DLCloseFailed, dlerror())
137
} /* namespace ScaleStack */