diff --git a/include/Mods/LoadLibrary.hpp b/include/Mods/LoadLibrary.hpp index b6647fa..6139ef2 100644 --- a/include/Mods/LoadLibrary.hpp +++ b/include/Mods/LoadLibrary.hpp @@ -2,8 +2,8 @@ #include namespace vl::mod { - void* LoadLibrary(const std::string& path, bool isGlobal); - bool CloseLibrary(void* handle); - void* LoadSymbol(void* handle, const std::string& name); + void* LoadModLibrary(const std::string& path, bool isGlobal); + bool CloseModLibrary(void* handle); + void* LoadModSymbol(void* handle, const std::string& name); } \ No newline at end of file diff --git a/src/Agent.cpp b/src/Agent.cpp index 15fe30f..9958a64 100644 --- a/src/Agent.cpp +++ b/src/Agent.cpp @@ -35,7 +35,7 @@ namespace vl::Agent { return; } - vl::mod::LoadLibrary(mods.at("VoidLoaderApi.vlmod").string(), true); + vl::mod::LoadModLibrary(mods.at("VoidLoaderApi.vlmod").string(), true); mods.erase("VoidLoaderApi.vlmod"); mods.erase("VoidLoader.vlmod"); diff --git a/src/Mods/LoadLibraryUnix.cpp b/src/Mods/LoadLibraryUnix.cpp index dc693d6..5bfcf80 100644 --- a/src/Mods/LoadLibraryUnix.cpp +++ b/src/Mods/LoadLibraryUnix.cpp @@ -1,21 +1,18 @@ -#if defined(unix) - #include #include namespace vl::mod { - void* LoadLibrary(const std::string& path, bool isGlobal) + void* LoadModLibrary(const std::string& path, bool isGlobal) { dlerror(); return dlopen(path.c_str(), isGlobal ? RTLD_NOW | RTLD_GLOBAL : RTLD_NOW); } - bool CloseLibrary(void* handle) + bool CloseModLibrary(void* handle) { return dlclose(handle) == 0; } - void* LoadSymbol(void* handle, const std::string& name) + void* LoadModSymbol(void* handle, const std::string& name) { dlerror(); return dlsym(handle, name.c_str()); } -} -#endif \ No newline at end of file +} \ No newline at end of file diff --git a/src/Mods/LoadLibraryWin.cpp b/src/Mods/LoadLibraryWin.cpp index 7d5ec9a..4a177a4 100644 --- a/src/Mods/LoadLibraryWin.cpp +++ b/src/Mods/LoadLibraryWin.cpp @@ -87,7 +87,7 @@ namespace vl::mod { assert(w_target_len == 0); } - void* LoadLibrary(const std::string& path, bool isGlobal) + void* LoadModLibrary(const std::string& path, bool isGlobal) { WCHAR filename_w[32768]; ssize_t r; @@ -102,11 +102,11 @@ namespace vl::mod { return LoadLibraryExW(filename_w, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); } - bool CloseLibrary(void* handle) + bool CloseModLibrary(void* handle) { return FreeLibrary(static_cast(handle)) != 0; } - void* LoadSymbol(void* handle, const std::string& name) + void* LoadModSymbol(void* handle, const std::string& name) { return (void*)(uintptr_t) GetProcAddress(static_cast(handle), name.c_str()); } diff --git a/src/Mods/Loader.cpp b/src/Mods/Loader.cpp index 06fbbbf..16b5d20 100644 --- a/src/Mods/Loader.cpp +++ b/src/Mods/Loader.cpp @@ -8,7 +8,7 @@ namespace vl::mod { std::size_t ModLoader::loadModule(const std::string& path, const Context& ctx, bool isGlobal) { - void* handle = LoadLibrary(path, isGlobal); + void* handle = LoadModLibrary(path, isGlobal); if (!handle) throw std::runtime_error(std::string("dlopen failed: ")); handles_.push_back(handle); @@ -49,7 +49,7 @@ void ModLoader::stopAll() { void ModLoader::unloadAll() { stopAll(); instances_.clear(); - for (auto* h : handles_) if (h) CloseLibrary(h); + for (auto* h : handles_) if (h) CloseModLibrary(h); handles_.clear(); } diff --git a/src/Mods/Registry.cpp b/src/Mods/Registry.cpp index 312f79e..9072846 100644 --- a/src/Mods/Registry.cpp +++ b/src/Mods/Registry.cpp @@ -21,8 +21,8 @@ std::vector& Registry::mutableAll() { std::size_t Registry::addFromModule(void* soHandle) { #if defined(__ELF__) using BoundPtr = const Registration*; - auto symStart = LoadSymbol(soHandle, "__start_vlmods"); - auto symStop = LoadSymbol(soHandle, "__stop_vlmods"); + auto symStart = LoadModSymbol(soHandle, "__start_vlmods"); + auto symStop = LoadModSymbol(soHandle, "__stop_vlmods"); if ((symStart == nullptr) || (symStop == nullptr)) { return 0;