Moved otherwise-unused underscore-prepending code in dlopen backend into an SDL-1.2
authorRyan C. Gordon <icculus@icculus.org>
Sat, 03 Feb 2007 08:11:45 +0000
branchSDL-1.2
changeset 3907a813fff94165
parent 3906 e3bf970d9494
child 3908 6e41f5d80198
Moved otherwise-unused underscore-prepending code in dlopen backend into an
#ifdef.

Fixes Bugzilla #354.
src/loadso/dlopen/SDL_sysloadso.c
     1.1 --- a/src/loadso/dlopen/SDL_sysloadso.c	Tue Jan 23 04:47:11 2007 +0000
     1.2 +++ b/src/loadso/dlopen/SDL_sysloadso.c	Sat Feb 03 08:11:45 2007 +0000
     1.3 @@ -45,12 +45,19 @@
     1.4  {
     1.5  	void *symbol = dlsym(handle, name);
     1.6  	if ( symbol == NULL ) {
     1.7 +
     1.8 +#ifdef DLOPEN_NEED_UNDERSCORE
     1.9 +		/* append an underscore for platforms that need that. */
    1.10  		size_t len = 1+SDL_strlen(name)+1;
    1.11  		char *_name = SDL_stack_alloc(char, len);
    1.12  		_name[0] = '_';
    1.13  		SDL_strlcpy(&_name[1], name, len);
    1.14 +		symbol = dlsym(handle, _name);
    1.15 +		SDL_stack_free(_name);
    1.16 +#else
    1.17  		symbol = dlsym(handle, name);
    1.18 -		SDL_stack_free(_name);
    1.19 +#endif
    1.20 +
    1.21  		if ( symbol == NULL ) {
    1.22  			SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror());
    1.23  		}