blob: b1e0b9bb970198f35999949597f8f44b085a8521 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include <dlfcn.h>
#include "xmlStorage.h"
#include "exceptions.h"
#include "library.h"
SimpleMessageException(LoadLibraryFailed);
SimpleMessageException(UnloadLibraryFailed);
Library::Library(const xmlpp::Element * p) :
SourceObject(p),
handle(dlopen(p->get_attribute_value("path").c_str(), RTLD_NOW))
{
if (!handle) {
throw LoadLibraryFailed(dlerror());
}
}
Library::~Library()
{
if (dlclose(handle)) {
throw UnloadLibraryFailed(dlerror());
}
}
void
Library::loadComplete(const CommonObjects*)
{
}
STORAGEOF(Library) libraries;
class LibraryLoader : public ElementLoaderImpl<Library> {
public:
void onIteration()
{
libraries.clear();
}
};
DECLARE_CUSTOM_LOADER("library", LibraryLoader);
|