From 8a9ad258f4262e8a81c5d8e4702460503d6825af Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Mon, 5 Jun 2023 11:19:02 -0400 Subject: [PATCH] Fix symbol resolution on windows. --- gpt4all-backend/llmodel.cpp | 12 ++++++++++-- gpt4all-backend/llmodel.h | 9 ++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/gpt4all-backend/llmodel.cpp b/gpt4all-backend/llmodel.cpp index 0835f42f..7499a75b 100644 --- a/gpt4all-backend/llmodel.cpp +++ b/gpt4all-backend/llmodel.cpp @@ -10,7 +10,7 @@ #include #include -std::string LLModel::m_implementations_search_path = "."; +std::string s_implementations_search_path = "."; static bool has_at_least_minimal_hardware() { #ifdef __x86_64__ @@ -98,7 +98,7 @@ const std::vector &LLModel::implementationList() { } }; - search_in_directory(m_implementations_search_path); + search_in_directory(s_implementations_search_path); return fres; }()); @@ -139,3 +139,11 @@ LLModel *LLModel::construct(const std::string &modelPath, std::string buildVaria // Construct and return llmodel implementation return impl->construct(); } + +void LLModel::setImplementationsSearchPath(const std::string& path) { + s_implementations_search_path = path; +} + +const std::string& LLModel::implementationsSearchPath() { + return s_implementations_search_path; +} diff --git a/gpt4all-backend/llmodel.h b/gpt4all-backend/llmodel.h index 406f78c6..95fe8267 100644 --- a/gpt4all-backend/llmodel.h +++ b/gpt4all-backend/llmodel.h @@ -79,12 +79,8 @@ public: static const Implementation *implementation(std::ifstream& f, const std::string& buildVariant); static LLModel *construct(const std::string &modelPath, std::string buildVariant = "default"); - static inline void setImplementationsSearchPath(const std::string& path) { - m_implementations_search_path = path; - } - static inline const std::string& implementationsSearchPath() { - return m_implementations_search_path; - } + static void setImplementationsSearchPath(const std::string& path); + static const std::string& implementationsSearchPath(); protected: // These are pure virtual because subclasses need to implement as the default implementation of @@ -101,6 +97,5 @@ protected: void recalculateContext(PromptContext &promptCtx, std::function recalculate); const Implementation *m_implementation = nullptr; - static std::string m_implementations_search_path; }; #endif // LLMODEL_H