Skip to content

Commit fc222cf

Browse files
committed
Fixed linux loading dynamic library
1 parent b4b5ec3 commit fc222cf

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/FlowBridger/EmbeddedScripts/Embedded.Cpp.RuntimeLoading.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ private:
7676
assert(h != nullptr);
7777
return (void*)h;
7878
#else
79-
void *h = dlopen(path.c_str(), RTLD_LAZY | RTLD_LOCAL);
79+
void *h = dlopen(WStringToString(path), RTLD_LAZY | RTLD_LOCAL);
8080
assert(h != nullptr);
8181
return h;
8282
#endif
@@ -95,6 +95,15 @@ private:
9595
#endif
9696
}
9797
98+
std::string WStringToString(const std::wstring& wstr)
99+
{
100+
std::string str;
101+
size_t size;
102+
str.resize(wstr.length());
103+
wcstombs_s(&size, &str[0], str.size() + 1, wstr.c_str(), wstr.size());
104+
return str;
105+
}
106+
98107
public:
99108
ImportFunctions(const std::wstring& pathToLibrary) {
100109
void *lib = loadLibrary(pathToLibrary);

0 commit comments

Comments
 (0)