Skip to content

Commit

Permalink
mtsManagerLocal: use PATH instead of LD_LIBRARY_PATH for dynamic load…
Browse files Browse the repository at this point in the history
…ing on Windows
  • Loading branch information
pkazanzides committed Nov 10, 2024
1 parent 602c1b3 commit 285e72e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions cisstMultiTask/code/mtsManagerLocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author(s): Min Yang Jung
Created on: 2009-12-07
(C) Copyright 2009-2020 Johns Hopkins University (JHU), All Rights Reserved.
(C) Copyright 2009-2024 Johns Hopkins University (JHU), All Rights Reserved.
--- begin cisst license - do not edit ---
Expand All @@ -20,6 +20,7 @@ no warranty. The complete license can be found in license.txt and

#include <cisstCommon/cmnThrow.h>
#include <cisstCommon/cmnPath.h>
#include <cisstCommon/cmnPortability.h>
#include <cisstOSAbstraction/osaSleep.h>
#include <cisstOSAbstraction/osaGetTime.h>
#include <cisstOSAbstraction/osaSocket.h>
Expand Down Expand Up @@ -905,15 +906,19 @@ mtsComponent * mtsManagerLocal::CreateComponentDynamicallyJSON(const std::string
{
// -1- try to dynamically load the library if specified
if (!sharedLibrary.empty()) {
// create load and path based on LD_LIBRARY_PATH
// create load and path based on LD_LIBRARY_PATH (or PATH on Windows)
osaDynamicLoader loader;
std::string fullPath;
// check if the file already exists, i.e. use provided a full path
if (cmnPath::Exists(sharedLibrary)) {
fullPath = sharedLibrary;
} else {
cmnPath path;
#if (CISST_OS == CISST_WINDOWS)
path.AddFromEnvironment("PATH");
#else
path.AddFromEnvironment("LD_LIBRARY_PATH");
#endif
fullPath = path.Find(cmnPath::SharedLibrary(sharedLibrary));
if (fullPath.empty()) {
fullPath = sharedLibrary;
Expand Down

0 comments on commit 285e72e

Please sign in to comment.