Mercurial > sdl-ios-xcode
comparison src/loadso/dlopen/SDL_sysloadso.c @ 3908:6e41f5d80198 SDL-1.2
Actually, this is dumb, just simplify this for now.
(But what if this finds the wrong symbol? We really should make this a
./configure test and only do one dlsym or the other depending on the
platform...)
Reference Bugzilla #354.
--ryan.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sat, 03 Feb 2007 08:17:12 +0000 |
parents | a813fff94165 |
children | a1b03ba2fcd0 |
comparison
equal
deleted
inserted
replaced
3907:a813fff94165 | 3908:6e41f5d80198 |
---|---|
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 /* append an underscore for platforms that need that. */ |
51 size_t len = 1+SDL_strlen(name)+1; | 49 size_t len = 1+SDL_strlen(name)+1; |
52 char *_name = SDL_stack_alloc(char, len); | 50 char *_name = SDL_stack_alloc(char, len); |
53 _name[0] = '_'; | 51 _name[0] = '_'; |
54 SDL_strlcpy(&_name[1], name, len); | 52 SDL_strlcpy(&_name[1], name, len); |
55 symbol = dlsym(handle, _name); | 53 symbol = dlsym(handle, _name); |
56 SDL_stack_free(_name); | 54 SDL_stack_free(_name); |
57 #else | |
58 symbol = dlsym(handle, name); | |
59 #endif | |
60 | |
61 if ( symbol == NULL ) { | 55 if ( symbol == NULL ) { |
62 SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror()); | 56 SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror()); |
63 } | 57 } |
64 } | 58 } |
65 return(symbol); | 59 return(symbol); |