comparison src/loadso/dlopen/SDL_sysloadso.c @ 2084:b656e6f09be3

Merged Bugzilla #354 fix into trunk.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 03 Feb 2007 08:18:41 +0000
parents c121d94672cb
children 3e42ad69f4a3
comparison
equal deleted inserted replaced
2083:db8ec0cfe6b8 2084:b656e6f09be3
45 void * 45 void *
46 SDL_LoadFunction(void *handle, const char *name) 46 SDL_LoadFunction(void *handle, const char *name)
47 { 47 {
48 void *symbol = dlsym(handle, name); 48 void *symbol = dlsym(handle, name);
49 if (symbol == NULL) { 49 if (symbol == NULL) {
50 /* append an underscore for platforms that need that. */
50 size_t len = 1 + SDL_strlen(name) + 1; 51 size_t len = 1 + SDL_strlen(name) + 1;
51 char *_name = SDL_stack_alloc(char, len); 52 char *_name = SDL_stack_alloc(char, len);
52 _name[0] = '_'; 53 _name[0] = '_';
53 SDL_strlcpy(&_name[1], name, len); 54 SDL_strlcpy(&_name[1], name, len);
54 symbol = dlsym(handle, name); 55 symbol = dlsym(handle, _name);
55 SDL_stack_free(_name); 56 SDL_stack_free(_name);
56 if (symbol == NULL) { 57 if (symbol == NULL) {
57 SDL_SetError("Failed loading %s: %s", name, 58 SDL_SetError("Failed loading %s: %s", name,
58 (const char *) dlerror()); 59 (const char *) dlerror());
59 } 60 }