forked from epics_driver_modules/require
search dependencies in the library dir
This instructs LoadLibrary to search dependent libraries in the dir where the module resides.
This commit is contained in:
+1
-1
@@ -29,7 +29,7 @@ USR_INCLUDES_Linux=-idirafter ${EPICS_BASE}/include
|
||||
USR_CFLAGS += -DT_A='"${T_A}"'
|
||||
|
||||
# This should really go into some global WIN32 config file
|
||||
USR_CFLAGS_WIN32 += /D_WIN32_WINNT=0x501
|
||||
USR_CFLAGS_WIN32 += /D_WIN32_WINNT=0x502
|
||||
|
||||
dbLoadTemplate.c: dbLoadTemplate_lex.c ../dbLoadTemplate.h
|
||||
|
||||
|
||||
@@ -300,21 +300,30 @@ static HMODULE loadlib(const char* libname)
|
||||
libname, dlerror());
|
||||
}
|
||||
#elif defined (_WIN32)
|
||||
if ((libhandle = LoadLibrary(libname)) == NULL)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
char *p;
|
||||
char *libpath = strdup(libname);
|
||||
if ((p = strrchr(libpath, '/')) != NULL)
|
||||
*p = '\0';
|
||||
SetDllDirectory(libpath);
|
||||
if ((libhandle = LoadLibrary(libname)) == NULL)
|
||||
{
|
||||
LPVOID lpMsgBuf;
|
||||
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0, NULL );
|
||||
fprintf (stderr, "Loading %s library failed: %s\n",
|
||||
libname, lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
FormatMessage(
|
||||
FORMAT_MESSAGE_ALLOCATE_BUFFER |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
GetLastError(),
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPTSTR) &lpMsgBuf,
|
||||
0, NULL );
|
||||
fprintf (stderr, "Loading %s library failed: %s\n",
|
||||
libname, lpMsgBuf);
|
||||
LocalFree(lpMsgBuf);
|
||||
}
|
||||
free(libpath);
|
||||
SetDllDirectory(NULL);
|
||||
}
|
||||
#elif defined (vxWorks)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user