mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-30 20:18:08 +00:00
use LOAD_WITH_ALTERED_SEARCH_PATH for LoadLibraryExA (#3908)
This commit is contained in:
parent
70abb120b3
commit
6f729b100f
2 changed files with 3 additions and 7 deletions
|
|
@ -447,7 +447,7 @@ class WindowsEnv : public Env {
|
|||
}
|
||||
|
||||
virtual Status LoadDynamicLibrary(const std::string& library_filename, void** handle) const override {
|
||||
*handle = ::LoadLibraryExA(library_filename.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR);
|
||||
*handle = ::LoadLibraryExA(library_filename.c_str(), nullptr, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||
if (!*handle)
|
||||
return common::Status(common::ONNXRUNTIME, common::FAIL, "Failed to load library");
|
||||
return common::Status::OK();
|
||||
|
|
|
|||
|
|
@ -346,15 +346,11 @@ TEST(CApiTest, DISABLED_test_custom_op_library) {
|
|||
|
||||
std::string lib_name;
|
||||
#if defined(_WIN32)
|
||||
char current_directory[/*MAX_PATH*/ 260];
|
||||
if (_getcwd(current_directory, _countof(current_directory)))
|
||||
lib_name = current_directory;
|
||||
lib_name += "\\custom_op_library.dll";
|
||||
|
||||
lib_name = "custom_op_library.dll";
|
||||
#elif defined(__APPLE__)
|
||||
lib_name = "libcustom_op_library.dylib";
|
||||
#else
|
||||
lib_name = "./libcustom_op_library.so";
|
||||
lib_name = "./libcustom_op_library.so";
|
||||
#endif
|
||||
|
||||
TestInference<PATH_TYPE, int32_t>(*ort_env, CUSTOM_OP_LIBRARY_TEST_MODEL_URI, inputs, "output", expected_dims_y, expected_values_y, 0, nullptr, lib_name.c_str());
|
||||
|
|
|
|||
Loading…
Reference in a new issue