~ubuntu-branches/ubuntu/wily/cxxtools/wily-proposed

« back to all changes in this revision

Viewing changes to src/dlloader.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kari Pahula
  • Date: 2006-12-07 00:06:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061207000647-8kgbtf58ef26s4i4
Tags: 1.4.3.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
#include "cxxtools/dlloader.h"
 
23
#include "cxxtools/log.h"
23
24
#include "config.h"
24
25
 
25
26
#ifdef USE_LIBTOOL
53
54
 
54
55
#endif
55
56
 
 
57
log_define("cxxtools.dlloader");
 
58
 
56
59
namespace cxxtools
57
60
{
58
61
 
118
121
  {
119
122
    close();
120
123
 
 
124
    log_debug("dlinit");
121
125
    DLINIT();
122
126
 
 
127
    log_debug("dlopen(\"" << name << "\")");
123
128
    handle = DLOPEN(name);
124
129
    if (!handle)
125
130
    {
 
131
      log_debug("dlopen(\"" << name << "\") failed");
126
132
      DLEXIT();
127
133
      throw DlopenError(name);
128
134
    }
 
135
 
 
136
    log_debug("dlopen => " << handle);
129
137
  }
130
138
 
131
139
  void Library::close()
134
142
    {
135
143
      if (prev == this)
136
144
      {
 
145
        log_debug("dlclose " << handle);
137
146
        DLCLOSE(handle);
138
147
        DLEXIT();
139
148
      }
149
158
 
150
159
  Symbol Library::sym(const char* name) const
151
160
  {
 
161
    log_debug("dlsym(" << handle << ", \"" << name << "\")");
152
162
    void* sym = DLSYM(handle, name);
153
163
    if (sym == 0)
 
164
    {
 
165
      log_debug("dlsym: symbol \"" << name << "\" not found");
154
166
      throw SymbolNotFound(name);
 
167
    }
155
168
 
 
169
    log_debug("dlsym => " << sym);
156
170
    return Symbol(*this, sym);
157
171
  }
158
172