[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

10035.0. "du eqivalent to solaris' dladdr ?" by DECC::SEIGEL () Tue Jun 03 1997 15:29

Hi,

We are trying to port some Sun code that uses the Solaris dladdr() entry point
to obtain the name of the currently executing shared library.  Does Digital
Unix PTA and above have an equivalent function, or some other mechanism for
obtaining the name of the currenty running shared library ?

Here is the Sun man page for dladdr:

     dladdr() determines if  the  specified  address  is  located
     within  one  of  the mapped objects that make up the current
     applications address space.  An address is  deemed  to  fall
     within  a mapped object when it is between the base address,
     and the _end address of that object.   If  a  mapped  object
     fits  this  criteria, the symbol table made available to the
     run-time linker is searched to locate the nearest symbol  to
     the specified address.  The nearest symbol is one that has a
     value less than or equal to the required address.

  RETURN VALUES
     If the specified address  cannot  be  matched  to  a  mapped
     object,  a  0  is  returned.  Otherwise a non-zero return is
     made and the associated Dl_info elements are filled.


Here is the Sun code that uses it:

    int SysInitialize () {
                ...
            /* Get name of runtime library */
            r = dladdr((void *)sysInitializeLinker, &dlip);
            sysAssert(r != 0);

            if ((dlsegment[useddlsegments].handle = dlopen(dlip.dli_fname,
                                                   RTLD_LAZY)) == 0)
                ...

Thanks, Harold
T.RTitleUserPersonal
Name
DateLines