Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/shared_lib/src/util/loading/dynamic_loader.cc @ 7169

Last change on this file since 7169 was 7169, checked in by bensch, 18 years ago

shared_lib: some functionality

File size: 1.5 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_LOADING
17
18#include "dynamic_loader.h"
19
20
21#include <dlfcn.h>
22
23
24using namespace std;
25
26
27/**
28 * standard constructor
29 * @todo this constructor is not jet implemented - do it
30*/
31DynamicLoader::DynamicLoader (const std::string& libName)
32{
33  this->setClassID(CL_DYNAMIC_LOADER, "DynamicLoader");
34
35  this->handle = NULL;
36
37  if (loadDynamicLib(libName));
38  this->setName(&libName[0]);
39}
40
41
42/**
43 * standard deconstructor
44*/
45DynamicLoader::~DynamicLoader ()
46{
47  // delete what has to be deleted here
48  if (this->handle != NULL)
49    dlclose(this->handle);
50}
51
52
53bool DynamicLoader::loadDynamicLib(const std::string& libName)
54{
55  this->handle = dlopen(&libName[0], RTLD_NOW);
56  if(this->handle == NULL)
57  {
58    return false;
59  }
60  void *mkr = dlsym( this->handle, "maker");
61}
62
63bool DynamicLoader::loadDyLib(const char* libName)
64{
65  void* handle;
66  handle = dlopen(libName, RTLD_NOW);
67  if(handle == NULL)
68  {
69    PRINTF(1)("unable to load %s: %s\n", libName, dlerror());
70
71    return false;
72  }
73//  void *mkr = dlsym("maker");
74
75}
76
77
78BaseObject* DynamicLoader::fabricateObject(const TiXmlElement* root) const
79{
80}
Note: See TracBrowser for help on using the repository browser.