mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-07-09 04:30:49 -04:00
5c9c76cc0b
Co-authored-by: qwertyquerty <qwertytrogi@gmail.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
36 lines
814 B
C++
36 lines
814 B
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
|
|
namespace dusk::mods::loader {
|
|
class NativeModule final {
|
|
public:
|
|
NativeModule() noexcept;
|
|
NativeModule(const NativeModule& other) = delete;
|
|
NativeModule(NativeModule&& other) noexcept;
|
|
explicit NativeModule(const std::filesystem::path& path);
|
|
~NativeModule();
|
|
|
|
void* LookupSymbol(const char* name) const;
|
|
|
|
template<typename T>
|
|
T LookupSymbol(const char* name) const {
|
|
return reinterpret_cast<T>(LookupSymbol(name));
|
|
}
|
|
|
|
NativeModule& operator=(NativeModule&& other) noexcept;
|
|
|
|
#if defined(_WIN32)
|
|
static constexpr auto LibraryExtension = ".dll";
|
|
#elif defined(__APPLE__)
|
|
static constexpr auto LibraryExtension = ".dylib";
|
|
#else
|
|
static constexpr auto LibraryExtension = ".so";
|
|
#endif
|
|
|
|
private:
|
|
void* handle;
|
|
};
|
|
|
|
}
|