* @brief Implementation of Dynamic Library Loader
*/
+#include <dlfcn.h>
#include <dl-loader.h>
+#include <webauthn-log.h>
namespace WA {
dlclose(m_libraryHandle);
}
+void *DLLoader::ResolveFunction(const std::string &name) noexcept
+{
+ LogDebug("Resolving symbol: " << name << " from " << m_libraryPath);
+ void *sym = dlsym(m_libraryHandle, name.c_str());
+ if (!sym)
+ LogError("Unable to resolve symbol: " << name << " from " << m_libraryPath << ": " << dlerror());
+ return sym;
+}
+
} // namespace WebAuthn
\ No newline at end of file
#pragma once
-#include <dlfcn.h>
#include <string>
#include <exception.h>
-#include <webauthn-log.h>
namespace WA {
explicit DLLoader(std::string path);
virtual ~DLLoader();
- virtual void *ResolveFunction(const std::string &name) noexcept
- {
- LogDebug("Resolving symbol: " << name << " from " << m_libraryPath);
- void *sym = dlsym(m_libraryHandle, name.c_str());
- if (!sym)
- LogError("Unable to resolve symbol: " << name << " from " << m_libraryPath << ": " << dlerror());
- return sym;
- }
+ virtual void *ResolveFunction(const std::string &name) noexcept;
template<typename ReturnValue, typename... Args>
ReturnValue Invoke(const std::string &name, Args... args)