rexlib 0.1.0
Device-agnostic array computing library for CryoEM and CryoET image processing, with a pluggable backend architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
rexlib::dynamic_library Class Reference

RAII style class to load, query and unload dynamic libraries. More...

#include <rexlib/core/system/dynamic_library.hpp>

Public Member Functions

 dynamic_library () noexcept
 Construct an empty dynamic_library object.
 
 dynamic_library (const char *filename)
 Construct a new dynamic_library object from a file.
 
 dynamic_library (const std::string &filename)
 Construct a new dynamic_library object from a file.
 
 dynamic_library (const dynamic_library &other)=delete
 
 dynamic_library (dynamic_library &&other) noexcept
 
dynamic_library & operator= (const dynamic_library &other)=delete
 
dynamic_library & operator= (dynamic_library &&other) noexcept
 
void swap (dynamic_library &other) noexcept
 
bool is_open () const noexcept
 Check if a dynamic library is loaded.
 
void open (const char *filename)
 Loads a dynamic library.
 
void open (const std::string &filename)
 Loads a dynamic library.
 
void close () noexcept
 Frees the stored dynamic library, if any.
 
void * get_symbol (const char *name) const noexcept
 Get the address of a symbol.
 
void * get_symbol (const std::string &name) const noexcept
 Get the address of a symbol.
 

Static Public Member Functions

static std::string query_symbol_filename (const void *symbol)
 Obtain the filename to the dynamic library from where the given symbol has been loaded.
 

Detailed Description

RAII style class to load, query and unload dynamic libraries.

Constructor & Destructor Documentation

◆ dynamic_library() [1/2]

rexlib::dynamic_library::dynamic_library ( const char *  filename)
explicit

Construct a new dynamic_library object from a file.

Parameters
filenamePath of the dynamic library file

◆ dynamic_library() [2/2]

rexlib::dynamic_library::dynamic_library ( const std::string &  filename)
explicit

Construct a new dynamic_library object from a file.

Parameters
filenamePath of the dynamic library file

Member Function Documentation

◆ get_symbol() [1/2]

void * rexlib::dynamic_library::get_symbol ( const char *  name) const
noexcept

Get the address of a symbol.

Parameters
nameName of the symbol
Returns
void* Pointer to the symbol. nullptr if not found

◆ get_symbol() [2/2]

void * rexlib::dynamic_library::get_symbol ( const std::string &  name) const
noexcept

Get the address of a symbol.

Parameters
nameName of the symbol
Returns
void* Pointer to the symbol. nullptr if not found

◆ is_open()

bool rexlib::dynamic_library::is_open ( ) const
noexcept

Check if a dynamic library is loaded.

Returns
bool Returns true if a library is loaded

◆ open() [1/2]

void rexlib::dynamic_library::open ( const char *  filename)

Loads a dynamic library.

Parameters
filenamePath to the dynamic library

◆ open() [2/2]

void rexlib::dynamic_library::open ( const std::string &  filename)

Loads a dynamic library.

Parameters
filenamePath to the dynamic library

◆ query_symbol_filename()

static std::string rexlib::dynamic_library::query_symbol_filename ( const void *  symbol)
static

Obtain the filename to the dynamic library from where the given symbol has been loaded.

Parameters
symbolThe symbol to be looked up.
Returns
std::string The path to the dynamic library from where the symbol has been loaded. Empty if no matching symbol was found.

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