Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 8bfffaa

Browse files
committed
fix: add dll search path
1 parent e180fc6 commit 8bfffaa

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

engine/controllers/server.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,9 @@ constexpr static auto kTensorrtLlmEngine = "cortex.tensorrt-llm";
2121
} // namespace
2222

2323
server::server() {
24-
25-
// Some default values for now below
26-
// log_disable(); // Disable the log to file feature, reduce bloat for
27-
// target
28-
// system ()
24+
#if defined(WIN32)
25+
SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS);
26+
#endif
2927
};
3028

3129
server::~server() {}
@@ -293,7 +291,12 @@ void server::LoadModel(const HttpRequestPtr& req,
293291
(getenv("ENGINE_PATH") ? getenv("ENGINE_PATH")
294292
: file_manager_utils::GetCortexDataPath().string()) +
295293
get_engine_path(engine_type);
296-
std::cout << abs_path << std::endl;
294+
#if defined(WIN32)
295+
auto ws = std::wstring(abs_path.begin(), abs_path.end());
296+
if (AddDllDirectory(ws.c_str()) == 0) {
297+
CTL_WRN("Could not add dll directory: " << abs_path);
298+
}
299+
#endif
297300
engines_[engine_type].dl =
298301
std::make_unique<cortex_cpp::dylib>(abs_path, "engine");
299302

0 commit comments

Comments
 (0)