Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/util/loading/dynamic_loader.cc @ 7574

Last change on this file since 7574 was 7355, checked in by bensch, 19 years ago

orxonox/trunk: works on windows too

File size: 1.6 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#ifndef __WIN32__
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    : Factory(NULL, CL_NULL)
33{
34  this->setClassID(CL_DYNAMIC_LOADER, "DynamicLoader");
35
36  this->handle = NULL;
37
38  if (loadDynamicLib(libName));
39  this->setName(&libName[0]);
40}
41
42
43/**
44 * standard deconstructor
45*/
46DynamicLoader::~DynamicLoader ()
47{
48  // delete what has to be deleted here
49  if (this->handle != NULL)
50    dlclose(this->handle);
51}
52
53
54bool DynamicLoader::loadDynamicLib(const std::string& libName)
55{
56  this->handle = dlopen(&libName[0], RTLD_NOW);
57  if(this->handle == NULL)
58  {
59    return false;
60  }
61  void *mkr = dlsym( this->handle, "maker");
62}
63
64bool DynamicLoader::loadDyLib(const std::string& libName)
65{
66  void* handle;
67  handle = dlopen(&libName[0], RTLD_NOW);
68  if(handle == NULL)
69  {
70    PRINTF(0)("unable to load %s\n", &libName[0]);
71    return false;
72  }
73//  void *mkr = dlsym("maker");
74
75}
76
77
78BaseObject* DynamicLoader::fabricateObject(const TiXmlElement* root) const
79{
80}
81#endif
Note: See TracBrowser for help on using the repository browser.