comparison src/loadso/dlopen/SDL_sysloadso.c @ 3907:a813fff94165 SDL-1.2

Moved otherwise-unused underscore-prepending code in dlopen backend into an #ifdef. Fixes Bugzilla #354.
author Ryan C. Gordon <icculus@icculus.org>
date Sat, 03 Feb 2007 08:11:45 +0000
parents 92947e3a18db
children 6e41f5d80198
comparison
equal deleted inserted replaced
3906:e3bf970d9494 3907:a813fff94165
43 43
44 void *SDL_LoadFunction(void *handle, const char *name) 44 void *SDL_LoadFunction(void *handle, const char *name)
45 { 45 {
46 void *symbol = dlsym(handle, name); 46 void *symbol = dlsym(handle, name);
47 if ( symbol == NULL ) { 47 if ( symbol == NULL ) {
48
49 #ifdef DLOPEN_NEED_UNDERSCORE
50 /* append an underscore for platforms that need that. */
48 size_t len = 1+SDL_strlen(name)+1; 51 size_t len = 1+SDL_strlen(name)+1;
49 char *_name = SDL_stack_alloc(char, len); 52 char *_name = SDL_stack_alloc(char, len);
50 _name[0] = '_'; 53 _name[0] = '_';
51 SDL_strlcpy(&_name[1], name, len); 54 SDL_strlcpy(&_name[1], name, len);
55 symbol = dlsym(handle, _name);
56 SDL_stack_free(_name);
57 #else
52 symbol = dlsym(handle, name); 58 symbol = dlsym(handle, name);
53 SDL_stack_free(_name); 59 #endif
60
54 if ( symbol == NULL ) { 61 if ( symbol == NULL ) {
55 SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror()); 62 SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror());
56 } 63 }
57 } 64 }
58 return(symbol); 65 return(symbol);