Merge pull request #339 from dorianj/master

libfreerdp-utils: freerdp_load_plugin print dlerror() on failure
This commit is contained in:
Marc-André Moreau 2012-01-10 15:16:07 -08:00
commit e2fffa063f

View File

@ -29,6 +29,7 @@
#define DLOPEN(f) LoadLibraryA(f) #define DLOPEN(f) LoadLibraryA(f)
#define DLSYM(f, n) GetProcAddress(f, n) #define DLSYM(f, n) GetProcAddress(f, n)
#define DLCLOSE(f) FreeLibrary(f) #define DLCLOSE(f) FreeLibrary(f)
#define DLERROR() ""
#define PATH_SEPARATOR '\\' #define PATH_SEPARATOR '\\'
#define PLUGIN_EXT "dll" #define PLUGIN_EXT "dll"
@ -39,6 +40,7 @@
#define DLOPEN(f) dlopen(f, RTLD_LOCAL | RTLD_LAZY) #define DLOPEN(f) dlopen(f, RTLD_LOCAL | RTLD_LAZY)
#define DLSYM(f, n) dlsym(f, n) #define DLSYM(f, n) dlsym(f, n)
#define DLCLOSE(f) dlclose(f) #define DLCLOSE(f) dlclose(f)
#define DLERROR() dlerror()
#define PATH_SEPARATOR '/' #define PATH_SEPARATOR '/'
#ifdef __APPLE__ #ifdef __APPLE__
@ -63,13 +65,13 @@ void* freerdp_load_plugin(const char* name, const char* entry_name)
module = DLOPEN(path); module = DLOPEN(path);
if (module == NULL) if (module == NULL)
{ {
printf("freerdp_load_plugin: failed to open %s.\n", path); printf("freerdp_load_plugin: failed to open %s: %s\n", path, DLERROR());
return NULL; return NULL;
} }
entry = DLSYM(module, entry_name); entry = DLSYM(module, entry_name);
if (entry == NULL) if (entry == NULL)
{ {
printf("freerdp_load_plugin: failed to load %s.\n", path); printf("freerdp_load_plugin: failed to load %s: %s\n", path, DLERROR());
return NULL; return NULL;
} }
return entry; return entry;