include/pops/runtime/dynamic/dynlib.hpp File ReferenceΒΆ

adc_cpp: include/pops/runtime/dynamic/dynlib.hpp File Reference
adc_cpp 0.3.0
Model-free C++23 core for coupled hyperbolic-elliptic systems on adaptive (AMR) meshes, with MPI and GPU (Kokkos) backends
dynlib.hpp File Reference

PORTABLE dynamic loading: dlopen/dlsym/dlclose (POSIX) <-> LoadLibraryW/ GetProcAddress/FreeLibrary (Windows). More...

#include <string>
#include <dlfcn.h>
+ Include dependency graph for dynlib.hpp:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  pops
 
namespace  pops::dynlib
 

Typedefs

using pops::dynlib::handle = void *
 

Functions

const char * pops::dynlib::suffix ()
 Platform dynamic library suffix.
 
handle pops::dynlib::open (const std::string &path)
 Opens a dynamic library (path in UTF-8). Returns a null handle on failure.
 
void * pops::dynlib::sym (handle h, const char *name)
 Resolves name in h. Returns nullptr if absent.
 
void pops::dynlib::close (handle h)
 Closes h (no-op on a null handle).
 
bool pops::dynlib::valid (handle h)
 true if h is a valid handle.
 
std::string pops::dynlib::last_error ()
 Last error message (best-effort, for diagnostics).
 

Detailed Description

PORTABLE dynamic loading: dlopen/dlsym/dlclose (POSIX) <-> LoadLibraryW/ GetProcAddress/FreeLibrary (Windows).

Minimal surface for the pops runtime (native loader / DSL .dll), ADC-99.

POSIX: strictly equivalent to the historical usage (RTLD_NOW | RTLD_LOCAL). The DSL "production" path has a SPECIAL need (RTLD_GLOBAL promotion to resolve the symbols of _pops exported as POPS_EXPORT through the dlopen) that stays handled at its call site; on the Windows side the equivalent goes through __declspec(dllexport) (cf. export.hpp) + import library, ADC-100.