1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Jens Arnold 2005-02-22 18:21:16 +00:00
parent ba454115ec
commit cf208c50a2
2 changed files with 17 additions and 10 deletions

View file

@ -289,11 +289,9 @@ int sim_fsync(int fd)
#ifdef WIN32 #ifdef WIN32
/* sim-win32 */ /* sim-win32 */
typedef enum plugin_status (*plugin_fn)(void* api, void* param);
#define dlopen(_x_, _y_) LoadLibrary(_x_) #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 dlclose(_x_) FreeLibrary(_x_)
#define dlerror() "Unknown"
#else #else
/* sim-x11 */ /* sim-x11 */
#include <dlfcn.h> #include <dlfcn.h>
@ -303,17 +301,25 @@ void *sim_plugin_load(char *plugin, int *fd)
{ {
void* pd; void* pd;
char path[256]; char path[256];
char buf[256];
int (*plugin_start)(void * api, void* param); int (*plugin_start)(void * api, void* param);
#ifdef WIN32
char buf[256];
#endif
snprintf(path, sizeof path, "archos%s", plugin); snprintf(path, sizeof path, "archos%s", plugin);
*fd = -1; *fd = -1;
pd = dlopen(path, RTLD_NOW); pd = dlopen(path, RTLD_NOW);
if (!pd) { if (!pd) {
snprintf(buf, sizeof buf, "failed to load %s", plugin); DEBUGF("failed to load %s\n", plugin);
DEBUGF("dlopen(%s): %s\n",path,dlerror()); #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); dlclose(pd);
return NULL; return NULL;
} }
@ -326,13 +332,13 @@ void *sim_plugin_load(char *plugin, int *fd)
return NULL; return NULL;
} }
} }
*fd = pd; /* success */ *fd = (int)pd; /* success */
return plugin_start; return plugin_start;
} }
void sim_plugin_close(int pd) void sim_plugin_close(int pd)
{ {
dlclose(pd); dlclose((void *)pd);
} }
#ifndef WIN32 #ifndef WIN32

View file

@ -33,4 +33,5 @@ void mpeg_bass(void)
void mpeg_treble(void) void mpeg_treble(void)
{ {
} }