Skip to content

Commit

Permalink
fix platformPath to windows dlopen
Browse files Browse the repository at this point in the history
  • Loading branch information
gewang committed Nov 4, 2024
1 parent 18a9c64 commit 4df6160
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/chuck_dl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3028,6 +3028,8 @@ void * dlopen( const char * path, int mode )
{
// return
void * retval = NULL;
// copy into string
std::string platformPath = path;

// add DLL search path | 1.5.4.0 (ge & nshaheed) added
// (e.g., for chugins that have DLL dependencies)
Expand All @@ -3051,11 +3053,11 @@ void * dlopen( const char * path, int mode )
// to take directories added by AddDllDirectory() into account, which
// is needed to load DLL dependencies of chugins...
// https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-adddlldirectory
retval = (void *)LoadLibraryEx( path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS );
retval = (void *)LoadLibraryEx( platformPath.c_str(), NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS );
#else
// 1.5.0.0 (ge) | #chunreal; explicitly call ASCII version
// the build envirnment seems to force UNICODE
retval = (void *)LoadLibraryExA( path, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS );
retval = (void *)LoadLibraryExA( platformPath.c_str(), NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS );
#endif

// undo the AddDllDirectory()
Expand Down

0 comments on commit 4df6160

Please sign in to comment.