diff options
Diffstat (limited to 'uisimulator/common')
-rw-r--r-- | uisimulator/common/io.c | 24 |
1 files changed, 15 insertions, 9 deletions
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) | |||
289 | 289 | ||
290 | #ifdef WIN32 | 290 | #ifdef WIN32 |
291 | /* sim-win32 */ | 291 | /* sim-win32 */ |
292 | typedef enum plugin_status (*plugin_fn)(void* api, void* param); | ||
293 | #define dlopen(_x_, _y_) LoadLibrary(_x_) | 292 | #define dlopen(_x_, _y_) LoadLibrary(_x_) |
294 | #define dlsym(_x_, _y_) (plugin_fn)GetProcAddress(_x_, _y_) | 293 | #define dlsym(_x_, _y_) (void *)GetProcAddress(_x_, _y_) |
295 | #define dlclose(_x_) FreeLibrary(_x_) | 294 | #define dlclose(_x_) FreeLibrary(_x_) |
296 | #define dlerror() "Unknown" | ||
297 | #else | 295 | #else |
298 | /* sim-x11 */ | 296 | /* sim-x11 */ |
299 | #include <dlfcn.h> | 297 | #include <dlfcn.h> |
@@ -303,17 +301,25 @@ void *sim_plugin_load(char *plugin, int *fd) | |||
303 | { | 301 | { |
304 | void* pd; | 302 | void* pd; |
305 | char path[256]; | 303 | char path[256]; |
306 | char buf[256]; | ||
307 | int (*plugin_start)(void * api, void* param); | 304 | int (*plugin_start)(void * api, void* param); |
308 | 305 | #ifdef WIN32 | |
306 | char buf[256]; | ||
307 | #endif | ||
308 | |||
309 | snprintf(path, sizeof path, "archos%s", plugin); | 309 | snprintf(path, sizeof path, "archos%s", plugin); |
310 | 310 | ||
311 | *fd = -1; | 311 | *fd = -1; |
312 | 312 | ||
313 | pd = dlopen(path, RTLD_NOW); | 313 | pd = dlopen(path, RTLD_NOW); |
314 | if (!pd) { | 314 | if (!pd) { |
315 | snprintf(buf, sizeof buf, "failed to load %s", plugin); | 315 | DEBUGF("failed to load %s\n", plugin); |
316 | DEBUGF("dlopen(%s): %s\n",path,dlerror()); | 316 | #ifdef WIN32 |
317 | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, | ||
318 | buf, sizeof buf, NULL); | ||
319 | DEBUGF("dlopen(%s): %s\n", path, buf); | ||
320 | #else | ||
321 | DEBUGF("dlopen(%s): %s\n", path, dlerror()); | ||
322 | #endif | ||
317 | dlclose(pd); | 323 | dlclose(pd); |
318 | return NULL; | 324 | return NULL; |
319 | } | 325 | } |
@@ -326,13 +332,13 @@ void *sim_plugin_load(char *plugin, int *fd) | |||
326 | return NULL; | 332 | return NULL; |
327 | } | 333 | } |
328 | } | 334 | } |
329 | *fd = pd; /* success */ | 335 | *fd = (int)pd; /* success */ |
330 | return plugin_start; | 336 | return plugin_start; |
331 | } | 337 | } |
332 | 338 | ||
333 | void sim_plugin_close(int pd) | 339 | void sim_plugin_close(int pd) |
334 | { | 340 | { |
335 | dlclose(pd); | 341 | dlclose((void *)pd); |
336 | } | 342 | } |
337 | 343 | ||
338 | #ifndef WIN32 | 344 | #ifndef WIN32 |