ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
ost::DSO Class Reference

The DSO dynamic loader class is used to load object files. More...

#include <file.h>

Collaboration diagram for ost::DSO:
[legend]

Public Member Functions

 DSO (const char *filename)
 Construct and load a DSO object file. More...
 
 DSO (const char *filename, bool resolve)
 
const char * getError (void) const
 Retrieve error indicator associated with DSO failure. More...
 
virtual ~DSO ()
 Detach a DSO object from running memory. More...
 
addr_t operator[] (const char *sym)
 Lookup a symbol in the loaded file. More...
 
bool isValid (void)
 See if DSO object is valid. More...
 

Static Public Member Functions

static void dynunload (void)
 
static DSOgetObject (const char *name)
 Find a specific DSO object by filename. More...
 
static void setDebug (void)
 Install debug handler... More...
 

Protected Member Functions

void loader (const char *filename, bool resolve)
 

Private Types

typedef ucommon::dso::addr_t addr_t
 

Private Member Functions

 __DELETE_COPY (DSO)
 

Private Attributes

const char * err
 
DSOnext
 
DSOprev
 
const char * id
 
void * image
 

Static Private Attributes

static Mutex mutex
 
static DSOfirst = NULL
 
static DSOlast = NULL
 

Detailed Description

The DSO dynamic loader class is used to load object files.

On elf based systems this is typically done with dlopen. A dummy stub class is generated for non-dl capable systems.

Author
David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m

Dynamic class file loader.

Definition at line 808 of file file.h.

Member Typedef Documentation

◆ addr_t

Definition at line 819 of file file.h.

Constructor & Destructor Documentation

◆ DSO() [1/2]

ost::DSO::DSO ( const char *  filename)
inline

Construct and load a DSO object file.

Parameters
filenamepathname of object file to load.

Definition at line 832 of file file.h.

◆ DSO() [2/2]

ost::DSO::DSO ( const char *  filename,
bool  resolve 
)
inline

Definition at line 836 of file file.h.

◆ ~DSO()

ost::DSO::~DSO ( )
virtual

Detach a DSO object from running memory.

Definition at line 90 of file dso.cpp.

References first, image, last, mutex, next, and prev.

Member Function Documentation

◆ __DELETE_COPY()

ost::DSO::__DELETE_COPY ( DSO  )
private

◆ dynunload()

void ost::DSO::dynunload ( void  )
static

Definition at line 80 of file dso.cpp.

References first, last, and prev.

◆ getError()

const char * ost::DSO::getError ( void  ) const
inline

Retrieve error indicator associated with DSO failure.

This is often used in catch handlers.

Definition at line 844 of file file.h.

◆ getObject()

DSO * ost::DSO::getObject ( const char *  name)
static

Find a specific DSO object by filename.

Parameters
nameof DSO object file (partial).

Definition at line 239 of file dso.cpp.

References ost::Mutex::enterMutex(), first, id, ost::Mutex::leaveMutex(), mutex, and stricmp().

Here is the call graph for this function:

◆ isValid()

bool ost::DSO::isValid ( void  )

See if DSO object is valid.

Returns
true if valid.

Definition at line 260 of file dso.cpp.

References image.

◆ loader()

void ost::DSO::loader ( const char *  filename,
bool  resolve 
)
protected

Definition at line 137 of file dso.cpp.

References ost::Mutex::enterMutex(), err, ost::Slog::error(), first, ost::Thread::getException(), id, image, init(), last, ost::Mutex::leaveMutex(), mutex, next, prev, ost::slog, ost::Thread::throwException, and ost::Thread::throwObject.

Here is the call graph for this function:

◆ operator[]()

DSO::addr_t ost::DSO::operator[] ( const char *  sym)

Lookup a symbol in the loaded file.

Definition at line 274 of file dso.cpp.

References ucommon::addr(), err, and image.

Here is the call graph for this function:

◆ setDebug()

void ost::DSO::setDebug ( void  )
static

Install debug handler...

Definition at line 331 of file dso.cpp.

Member Data Documentation

◆ err

const char* ost::DSO::err
private

Definition at line 811 of file file.h.

Referenced by loader(), and operator[]().

◆ first

DSO * ost::DSO::first = NULL
staticprivate

Definition at line 813 of file file.h.

Referenced by dynunload(), getObject(), loader(), and ~DSO().

◆ id

const char* ost::DSO::id
private

Definition at line 816 of file file.h.

Referenced by getObject(), and loader().

◆ image

void* ost::DSO::image
private

Definition at line 817 of file file.h.

Referenced by isValid(), loader(), operator[](), and ~DSO().

◆ last

DSO * ost::DSO::last = NULL
staticprivate

Definition at line 814 of file file.h.

Referenced by dynunload(), loader(), and ~DSO().

◆ mutex

Mutex ost::DSO::mutex
staticprivate

Definition at line 812 of file file.h.

Referenced by getObject(), loader(), and ~DSO().

◆ next

DSO* ost::DSO::next
private

Definition at line 815 of file file.h.

Referenced by loader(), and ~DSO().

◆ prev

DSO * ost::DSO::prev
private

Definition at line 815 of file file.h.

Referenced by dynunload(), loader(), and ~DSO().


The documentation for this class was generated from the following files: