dylib Class Reference
Kynema API
A flexible multibody structural dynamics code for wind turbines
|
Loading...
Searching...
No Matches
Classes |
Public Types |
Public Member Functions |
Static Public Attributes |
Static Protected Member Functions |
Protected Attributes |
List of all members
kynema::util::dylib Class Reference
#include <dylib.hpp>
Classes | |
class | exception |
struct | filename_components |
class | load_error |
class | symbol_error |
Public Types | |
using | native_handle_type = DYLIB_WIN_OTHER(HINSTANCE, void *) |
using | native_symbol_type = DYLIB_WIN_OTHER(FARPROC, void *) |
Public Member Functions | |
dylib (const dylib &)=delete | |
dylib & | operator= (const dylib &)=delete |
dylib (dylib &&other) noexcept | |
dylib & | operator= (dylib &&other) noexcept |
~dylib () | |
native_symbol_type | get_symbol (const char *symbol_name) const |
native_symbol_type | get_symbol (const std::string &symbol_name) const |
template<typename T > | |
T * | get_function (const char *symbol_name) const |
template<typename T > | |
T * | get_function (const std::string &symbol_name) const |
template<typename T > | |
T & | get_variable (const char *symbol_name) const |
template<typename T > | |
T & | get_variable (const std::string &symbol_name) const |
bool | has_symbol (const char *symbol_name) const noexcept |
bool | has_symbol (const std::string &symbol) const noexcept |
native_handle_type | native_handle () noexcept |
dylib (const char *dir_path, const char *lib_name, bool decorations=add_filename_decorations) | |
dylib (const std::string &dir_path, const std::string &lib_name, bool decorations=add_filename_decorations) | |
dylib (const std::string &dir_path, const char *lib_name, bool decorations=add_filename_decorations) | |
dylib (const char *dir_path, const std::string &lib_name, bool decorations=add_filename_decorations) | |
dylib (const std::string &lib_name, bool decorations=add_filename_decorations) | |
dylib (const char *lib_name, bool decorations=add_filename_decorations) | |
Static Public Attributes | |
static constexpr bool | add_filename_decorations = true |
static constexpr bool | no_filename_decorations = false |
Static Protected Member Functions | |
static native_handle_type | open (const char *path) noexcept |
static native_symbol_type | locate_symbol (native_handle_type lib, const char *name) noexcept |
static void | close (native_handle_type lib) noexcept |
static std::string | get_error_description () |
Protected Attributes | |
native_handle_type | m_handle {nullptr} |
Detailed Description
The dylib
class represents a single dynamic library instance, allowing the access of symbols like functions or global variables
Member Typedef Documentation
◆ native_handle_type
using kynema::util::dylib::native_handle_type = DYLIB_WIN_OTHER(HINSTANCE, void*) |
◆ native_symbol_type
using kynema::util::dylib::native_symbol_type = DYLIB_WIN_OTHER(FARPROC, void*) |
Constructor & Destructor Documentation
◆ dylib() [1/8]
|
delete |
◆ dylib() [2/8]
|
inlinenoexcept |
◆ dylib() [3/8]
|
inline |
Loads a dynamic library
- Exceptions
-
`dylib::load_error` if the library could not be opened (including the case of the library file not being found) `std::invalid_argument` if the arguments are null
- Parameters
-
dir_path the directory path where the dynamic library is located lib_name the name of the dynamic library to load decorations adds OS-specific decorations to the library name
◆ dylib() [4/8]
|
inline |
◆ dylib() [5/8]
|
inline |
◆ dylib() [6/8]
|
inline |
◆ dylib() [7/8]
|
inlineexplicit |
◆ dylib() [8/8]
|
inlineexplicit |
◆ ~dylib()
|
inline |
Member Function Documentation
◆ close()
|
inlinestaticprotectednoexcept |
◆ get_error_description()
|
inlinestaticprotected |
◆ get_function() [1/2]
template<typename T >
|
inline |
Get a function from the currently loaded dynamic library
- Exceptions
-
`dylib::symbol_error` if the function could not be found `std::invalid_argument` if the argument is null
- Template Parameters
-
T the function type, e.g., double(int, int)
- Parameters
-
symbol_name the function name to lookup
- Returns
- a pointer to the requested function
◆ get_function() [2/2]
template<typename T >
|
inline |
◆ get_symbol() [1/2]
|
inline |
Get a symbol from the currently loaded dynamic library
- Exceptions
-
`dylib::symbol_error` if the symbol could not be found `std::invalid_argument` if the argument or library handle is null
- Parameters
-
symbol_name the symbol name to lookup
- Returns
- a pointer to the requested symbol
◆ get_symbol() [2/2]
|
inline |
◆ get_variable() [1/2]
template<typename T >
|
inline |
Get a variable from the currently loaded dynamic library
- Exceptions
-
`dylib::symbol_error` if the variable could not be found `std::invalid_argument` if the argument is null
- Template Parameters
-
T the variable type
- Parameters
-
symbol_name the variable name to lookup
- Returns
- a reference to the requested variable
◆ get_variable() [2/2]
template<typename T >
|
inline |
◆ has_symbol() [1/2]
|
inlinenoexcept |
Check if a symbol exists in the currently loaded dynamic library. This method will return false if no dynamic library is currently loaded or if the symbol name is nullptr
- Parameters
-
symbol_name the symbol name to look for
- Returns
- true if the symbol exists in the dynamic library, false otherwise
◆ has_symbol() [2/2]
|
inlinenoexcept |
◆ locate_symbol()
|
inlinestaticprotectednoexcept |
◆ native_handle()
|
inlinenoexcept |
- Returns
- the dynamic library handle
◆ open()
|
inlinestaticprotectednoexcept |
◆ operator=() [1/2]
◆ operator=() [2/2]
Member Data Documentation
◆ add_filename_decorations
|
staticconstexpr |
◆ m_handle
|
protected |
◆ no_filename_decorations
|
staticconstexpr |
The documentation for this class was generated from the following file:
- /home/runner/work/kynema/kynema/kynema/src/vendor/dylib/dylib.hpp
Generated by