diff --git a/dynload.c b/dynload.c index 9482e9b..40582d9 100644 --- a/dynload.c +++ b/dynload.c @@ -130,6 +130,20 @@ lookup_dlsym(char *name, long *location) name++; #endif + /* find the name in the self process image - ie original scheme48 + executable file */ + if (!selfhandle) + selfhandle=dlopen((char*)0, S48_DLOPEN_MODE); + if (adr=dlsym(selfhandle, name)) { + *location = (long) adr; +#ifdef DLDEBUG + printf(" %s:%d %s name='%s' in self at adr=%#x\n", + __FILE__, __LINE__, __FUNCTION__, + name, (long) adr); +#endif /*DLDEBUG*/ + return 1; + }; + /* perhaps i should scan the dlopened_handle from last to first, to find newest incarnation of symbol? in practice it should be faster to go from first (oldest) to last, @@ -145,19 +159,6 @@ lookup_dlsym(char *name, long *location) #endif /*DLDEBUG*/ return 1; }; - /* find the name in the self process image - ie original scheme48 - executable file */ - if (!selfhandle) - selfhandle=dlopen((char*)0, S48_DLOPEN_MODE); - if (adr=dlsym(selfhandle, name)) { - *location = (long) adr; -#ifdef DLDEBUG - printf(" %s:%d %s name='%s' in self at adr=%#x\n", - __FILE__, __LINE__, __FUNCTION__, - name, (long) adr); -#endif /*DLDEBUG*/ - return 1; - }; /* can't find name so return 0 */ #ifdef DLDEBUG printf(" %s:%d %s name='%s' not found\n",