Fix Window search path for ANSLIB

This commit is contained in:
2026-04-06 08:31:26 +10:00
parent f7cef5015a
commit 091a61d2be
10 changed files with 283 additions and 11 deletions

View File

@@ -7,10 +7,27 @@
namespace ANSCENTER
{
ANSLIB::ANSLIB() {
// Pre-load all ANSCORE DLLs from the Shared folder using full paths.
// This ensures the correct versions are loaded regardless of PATH order
// (e.g., DLHUB_Runtime_Engine may contain older copies on some machines).
// Once loaded, Windows reuses them for all subsequent implicit dependencies.
const char* sharedDir = "C:\\ProgramData\\ANSCENTER\\Shared\\";
const char* preloadDlls[] = {
"ANSLicensingSystem.dll",
"anslicensing.dll",
"ANSMOT.dll",
"ANSODEngine.dll",
nullptr
};
for (int i = 0; preloadDlls[i] != nullptr; i++) {
std::string fullPath = std::string(sharedDir) + preloadDlls[i];
LoadLibraryA(fullPath.c_str());
}
// Ensure all shared DLLs (OpenCV, OpenVINO, TRT, ORT) are pre-loaded
ANSCENTER::ANSLibsLoader::Initialize();
const char* dllPath = "C:\\ProgramData\\ANSCENTER\\Shared\\ANSODEngine.dll"; // Hardcoded path
const char* dllPath = "C:\\ProgramData\\ANSCENTER\\Shared\\ANSODEngine.dll";
dllHandle = LoadLibraryA(dllPath);
if (!dllHandle) {
return;