Skip to content

Commit

Permalink
Moved otherwise-unused underscore-prepending code in dlopen backend i…
Browse files Browse the repository at this point in the history
…nto an

 #ifdef.

Fixes Bugzilla #354.
  • Loading branch information
icculus committed Feb 3, 2007
1 parent 0edd197 commit 7e9130d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/loadso/dlopen/SDL_sysloadso.c
Expand Up @@ -45,12 +45,19 @@ void *SDL_LoadFunction(void *handle, const char *name)
{
void *symbol = dlsym(handle, name);
if ( symbol == NULL ) {

#ifdef DLOPEN_NEED_UNDERSCORE
/* append an underscore for platforms that need that. */
size_t len = 1+SDL_strlen(name)+1;
char *_name = SDL_stack_alloc(char, len);
_name[0] = '_';
SDL_strlcpy(&_name[1], name, len);
symbol = dlsym(handle, name);
symbol = dlsym(handle, _name);
SDL_stack_free(_name);
#else
symbol = dlsym(handle, name);
#endif

if ( symbol == NULL ) {
SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror());
}
Expand Down

0 comments on commit 7e9130d

Please sign in to comment.