From d377702c177d84132dd5bc82bfa8a7917afcb91c Mon Sep 17 00:00:00 2001 From: Faumaray Date: Tue, 21 Oct 2025 00:37:32 +0300 Subject: [PATCH] fixing mingw errors Signed-off-by: Faumaray --- CMakeLists.txt | 6 ++++++ include/Mods/LoadLibrary.hpp | 13 ++++++++----- include/Mods/LoadLibraryUnix.hpp | 11 ----------- include/Mods/LoadLibraryWin.hpp | 10 ---------- src/Mods/LoadLibraryUnix.cpp | 2 +- src/Mods/LoadLibraryWin.cpp | 7 ++----- 6 files changed, 17 insertions(+), 32 deletions(-) delete mode 100644 include/Mods/LoadLibraryUnix.hpp delete mode 100644 include/Mods/LoadLibraryWin.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ce8f4e..2719713 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,12 @@ else() add_compile_options(-fPIC) endif() +if (MINGW OR WIN32) + list(FILTER SOURCES EXCLUDE REGEX "LoadLibraryUnix\\.cpp$") +else() + list(FILTER SOURCES EXCLUDE REGEX "LoadLibraryWin\\.cpp$") +endif() + # ============================================================ # Build shared library # ============================================================ diff --git a/include/Mods/LoadLibrary.hpp b/include/Mods/LoadLibrary.hpp index a009e74..b6647fa 100644 --- a/include/Mods/LoadLibrary.hpp +++ b/include/Mods/LoadLibrary.hpp @@ -1,6 +1,9 @@ #pragma once -#if defined(_WIN32) -# include -#else -# include -#endif \ No newline at end of file +#include +namespace vl::mod { + + void* LoadLibrary(const std::string& path, bool isGlobal); + bool CloseLibrary(void* handle); + void* LoadSymbol(void* handle, const std::string& name); + +} \ No newline at end of file diff --git a/include/Mods/LoadLibraryUnix.hpp b/include/Mods/LoadLibraryUnix.hpp deleted file mode 100644 index a77690b..0000000 --- a/include/Mods/LoadLibraryUnix.hpp +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once -#if defined(unix) -#include -namespace vl::mod { - - void* LoadLibrary(const std::string& path, bool isGlobal); - bool CloseLibrary(void* handle); - void* LoadSymbol(void* handle, const std::string& name); - -} -#endif \ No newline at end of file diff --git a/include/Mods/LoadLibraryWin.hpp b/include/Mods/LoadLibraryWin.hpp deleted file mode 100644 index d89023f..0000000 --- a/include/Mods/LoadLibraryWin.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once -#if defined(_WIN32) - -#include -namespace vl::mod { - void* LoadLibrary(const std::string& path, bool isGlobal); - bool CloseLibrary(void* handle); - void* LoadSymbol(void* handle, const std::string& name); -} -#endif \ No newline at end of file diff --git a/src/Mods/LoadLibraryUnix.cpp b/src/Mods/LoadLibraryUnix.cpp index 74b2732..dc693d6 100644 --- a/src/Mods/LoadLibraryUnix.cpp +++ b/src/Mods/LoadLibraryUnix.cpp @@ -1,6 +1,6 @@ #if defined(unix) -#include +#include #include namespace vl::mod { void* LoadLibrary(const std::string& path, bool isGlobal) diff --git a/src/Mods/LoadLibraryWin.cpp b/src/Mods/LoadLibraryWin.cpp index eed930b..7d5ec9a 100644 --- a/src/Mods/LoadLibraryWin.cpp +++ b/src/Mods/LoadLibraryWin.cpp @@ -1,6 +1,4 @@ -#if defined(_WIN32) - -#include +#include #include #include #include @@ -112,5 +110,4 @@ namespace vl::mod { { return (void*)(uintptr_t) GetProcAddress(static_cast(handle), name.c_str()); } -} -#endif \ No newline at end of file +} \ No newline at end of file