mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-16 11:06:49 +01:00
SDL_LoadObject on Windows now calls LoadLibrary a second time in its EX form whenever the first load fails. This second call uses the "altered" search path for DLL dependencies, which includes searching the directory that the DLL itself lives in.
This commit is contained in:
parent
b6be1435c5
commit
dfa53e7e3c
@ -34,6 +34,19 @@ SDL_LoadObject(const char *sofile)
|
|||||||
{
|
{
|
||||||
LPTSTR tstr = WIN_UTF8ToString(sofile);
|
LPTSTR tstr = WIN_UTF8ToString(sofile);
|
||||||
void *handle = (void *) LoadLibrary(tstr);
|
void *handle = (void *) LoadLibrary(tstr);
|
||||||
|
|
||||||
|
/* By default LoadLibrary uses the current working directory
|
||||||
|
* as the first item on the search path for implicit dependencies
|
||||||
|
* of whatever it's loading. That is somewhat inconsistent with
|
||||||
|
* what dlopen does on other platforms, so we will try again
|
||||||
|
* with LoadLibraryEx and a slightly different search path. This
|
||||||
|
* causes Windows to search for dependencies in the directory
|
||||||
|
* that the module itself lives in. */
|
||||||
|
if(handle == NULL)
|
||||||
|
{
|
||||||
|
handle = (void *) LoadLibraryEx(tstr, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
|
||||||
|
}
|
||||||
|
|
||||||
SDL_free(tstr);
|
SDL_free(tstr);
|
||||||
|
|
||||||
/* Generate an error message if all loads failed */
|
/* Generate an error message if all loads failed */
|
||||||
|
Loading…
Reference in New Issue
Block a user