2#include "Logging/Logger.h"
13 std::span<const char*> dllVersions() {
15 static std::array paths = {
".macOS.Debug.dylib" };
16 return std::span<const char*>(paths);
17#elif defined( OSOMP_EnableProfiler )
18 static std::array paths = {
".macOS.ReleaseMemProfile.dylib",
".macOS.Release.dylib" };
19 return std::span<const char*>(paths);
21 static std::array paths = {
".macOS.ReleaseASan.dylib"),
".macOS.Release.dylib" };
22 return std::span<const char*>(paths);
24 static std::array paths = {
".macOS.ReleaseTSan.dylib",
".macOS.Release.dylib" };
25 return std::span<const char*>(paths);
27 static std::array paths = {
".macOS.Release.dylib" };
28 return std::span<const char*>(paths);
44 if (path.find(
".dylib") == std::string::npos){
45 std::span<const char*> versions = dllVersions();
46 std::string libraryPath;
47 libraryPath.reserve(path.size() + 40);
49 for (
const char* version : versions) {
53 libraryPath += version;
55 handle = ::dlopen(libraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
60 handle = dlopen(path.data(), RTLD_NOW | RTLD_LOCAL);
62 if(handle ==
nullptr) {
63 LOG_ERROR(logger,
"dlopen failed: %s", dlerror());
65 status = handle ? LoadStatus::Loaded : LoadStatus::Failed;
68void Cogs::Module::unload(
void* handle) {
80void* Cogs::Module::getProcAddress(
void* handle,
const char* procName) {
81 return dlsym(handle, procName);
Log implementation class.
static void load(const std::string &path, LoadStatus &status, void *&handle)
Attempts to load a shared library with the given name.
constexpr Log getLogger(const char(&name)[LEN]) noexcept