CMSDK 2.0.1
Cross-platform C++ base library and SDK for the Psyclone AIOS platform
Loading...
Searching...
No Matches
cmlabs::utils::Library Class Reference

Thin RAII wrapper around a dynamically loaded library (LoadLibrary / dlopen). More...

#include <Utils.h>

Public Member Functions

 Library ()
 ~Library ()
bool load (const char *filename)
 Load a library.
LibraryFunction getFunction (const char *funcName)
 Resolve an exported function.

Static Public Member Functions

static std::string patchLibraryFilename (const char *filename, const char *path=NULL)
 Normalize a library name into a platform filename (adds lib prefix / .dll, .so, .dylib suffix and optional path).

Detailed Description

Thin RAII wrapper around a dynamically loaded library (LoadLibrary / dlopen).

Definition at line 1331 of file Utils.h.

Constructor & Destructor Documentation

◆ Library()

cmlabs::utils::Library::Library ( )

Definition at line 4581 of file Utils.cpp.

◆ ~Library()

cmlabs::utils::Library::~Library ( )

Definition at line 4584 of file Utils.cpp.

Member Function Documentation

◆ getFunction()

LibraryFunction cmlabs::utils::Library::getFunction ( const char * funcName)

Resolve an exported function.

Parameters
funcNameSymbol name.
Returns
Function pointer or NULL.

Definition at line 4715 of file Utils.cpp.

References LOG_SYSTEM, and LogPrint.

◆ load()

bool cmlabs::utils::Library::load ( const char * filename)

Load a library.

Parameters
filenameLibrary file (see patchLibraryFilename()).
Returns
true on success.

Definition at line 4627 of file Utils.cpp.

References cmlabs::utils::GetCommandLinePath(), LOG_SYSTEM, LogPrint, patchLibraryFilename(), cmlabs::utils::StringFormat(), and cmlabs::utils::StringSingleReplace().

Referenced by cmlabs::utils::OpenLibrary().

◆ patchLibraryFilename()

std::string cmlabs::utils::Library::patchLibraryFilename ( const char * filename,
const char * path = NULL )
static

Normalize a library name into a platform filename (adds lib prefix / .dll, .so, .dylib suffix and optional path).

Parameters
filenameBase library name.
pathOptional directory.
Returns
Full platform-specific filename.

Definition at line 4597 of file Utils.cpp.

References cmlabs::utils::StringFormat(), cmlabs::utils::TextEndsWith(), and cmlabs::utils::TextStartsWith().

Referenced by load().


The documentation for this class was generated from the following files:
  • /home/ubuntu/c/partner/psyclone2/CMSDK/include/Utils.h
  • /home/ubuntu/c/partner/psyclone2/CMSDK/src/Utils.cpp