From cf208c50a2b52d0dd5a79567aeef4738c6082137 Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Tue, 22 Feb 2005 18:21:16 +0000 Subject: Killed some simulator warnings; proper plugin error reporting for Win32 simulator. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6039 a1c6a512-1295-4272-9138-f99709370657 --- uisimulator/common/io.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'uisimulator/common') diff --git a/uisimulator/common/io.c b/uisimulator/common/io.c index 48b888a027..33f1091314 100644 --- a/uisimulator/common/io.c +++ b/uisimulator/common/io.c @@ -289,11 +289,9 @@ int sim_fsync(int fd) #ifdef WIN32 /* sim-win32 */ -typedef enum plugin_status (*plugin_fn)(void* api, void* param); #define dlopen(_x_, _y_) LoadLibrary(_x_) -#define dlsym(_x_, _y_) (plugin_fn)GetProcAddress(_x_, _y_) +#define dlsym(_x_, _y_) (void *)GetProcAddress(_x_, _y_) #define dlclose(_x_) FreeLibrary(_x_) -#define dlerror() "Unknown" #else /* sim-x11 */ #include @@ -303,17 +301,25 @@ void *sim_plugin_load(char *plugin, int *fd) { void* pd; char path[256]; - char buf[256]; int (*plugin_start)(void * api, void* param); - +#ifdef WIN32 + char buf[256]; +#endif + snprintf(path, sizeof path, "archos%s", plugin); *fd = -1; pd = dlopen(path, RTLD_NOW); if (!pd) { - snprintf(buf, sizeof buf, "failed to load %s", plugin); - DEBUGF("dlopen(%s): %s\n",path,dlerror()); + DEBUGF("failed to load %s\n", plugin); +#ifdef WIN32 + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, + buf, sizeof buf, NULL); + DEBUGF("dlopen(%s): %s\n", path, buf); +#else + DEBUGF("dlopen(%s): %s\n", path, dlerror()); +#endif dlclose(pd); return NULL; } @@ -326,13 +332,13 @@ void *sim_plugin_load(char *plugin, int *fd) return NULL; } } - *fd = pd; /* success */ + *fd = (int)pd; /* success */ return plugin_start; } void sim_plugin_close(int pd) { - dlclose(pd); + dlclose((void *)pd); } #ifndef WIN32 -- cgit v1.2.3