From 8bfffaaef784d8b87ddcb70bdb2376d43c1634e0 Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Tue, 10 Sep 2024 09:44:01 +0700 Subject: [PATCH] fix: add dll search path --- engine/controllers/server.cc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/engine/controllers/server.cc b/engine/controllers/server.cc index 42a7595be..43ef21d43 100644 --- a/engine/controllers/server.cc +++ b/engine/controllers/server.cc @@ -21,11 +21,9 @@ constexpr static auto kTensorrtLlmEngine = "cortex.tensorrt-llm"; } // namespace server::server() { - - // Some default values for now below - // log_disable(); // Disable the log to file feature, reduce bloat for - // target - // system () +#if defined(WIN32) + SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); +#endif }; server::~server() {} @@ -293,7 +291,12 @@ void server::LoadModel(const HttpRequestPtr& req, (getenv("ENGINE_PATH") ? getenv("ENGINE_PATH") : file_manager_utils::GetCortexDataPath().string()) + get_engine_path(engine_type); - std::cout << abs_path << std::endl; +#if defined(WIN32) + auto ws = std::wstring(abs_path.begin(), abs_path.end()); + if (AddDllDirectory(ws.c_str()) == 0) { + CTL_WRN("Could not add dll directory: " << abs_path); + } +#endif engines_[engine_type].dl = std::make_unique(abs_path, "engine");