*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> st_dyn_addr (3)              
Title
Content
Arch
Section
 

st_dyn_start(3)

Contents


NAME    [Toc]    [Back]

       st_dyn_start,  st_dyn_next, st_dyn_count, st_dyn_find_tag,
       st_dyn_tag, st_dyn_value, st_dyn_addr  -  Access  routines
       for dynamic header information in shared objects

SYNOPSIS    [Toc]    [Back]

       #include <st.h>

       st_status_t st_dyn_start(
               st_obj_t *obj,
               st_dynscn_t *pdyn ); st_status_t st_dyn_next(
               st_obj_t *obj,
               st_dynscn_t dcur,
               st_dynscn_t *pdyn ); st_status_t st_dyn_count(
               st_obj_t *obj,
               unsigned     int     *pcount     );    st_status_t
       st_dyn_find_tag(
               st_obj_t *obj,
               unsigned int tag,
               st_dynscn_t *pdyn ); st_status_t st_dyn_tag(
               st_obj_t *obj,
               st_dynscn_t dyn,
               unsigned int *ptag ); st_status_t st_dyn_value(
               st_obj_t *obj,
               st_dynscn_t dyn,
               unsigned long *pvalue ); st_status_t st_dyn_addr(
               st_obj_t *obj,
               st_dynscn_t dyn,
               st_addr_t *addr );

LIBRARY    [Toc]    [Back]

       Symbol Table and Object File Access Library (libst.a)

PARAMETERS    [Toc]    [Back]

       Specifies  an  object   handle,   as   returned   by   the
       st_obj_open()  function.   Specifies  an  address to which
       st_dyn_start(), st_dyn_next(), or st_dyn_find_tag() return
       a  dynamic  section  handle.   Specifies a dynamic section
       handle as returned by  st_dyn_start(),  st_dyn_next(),  or
       st_dyn_find_tag()  functions.   Specifies  an  address  to
       which st_dyn_count() returns the number of entries in  the
       dynamic   section.    Specifies   an   address   to  which
       st_dyn_tag() returns a dynamic section tag.   Specifies  a
       dynamic  section  tag. Dynamic section tags are defined in
       /usr/include/coff_dyn.h. The Object File/Symbol Table Format
  Specification  provides a complete description of all
       dynamic section  tags.   Specifies  an  address  to  which
       st_dyn_value()  returns  a  dynamic section value. Dynamic
       section values may be either link-time addresses or  absolute
  values.  The  dynamic section tag determines how the
       associated dynamic section value  should  be  interpreted.
       The  Object File/Symbol Table Format Specification identifies
 value interpretations for all dynamic  section  tags.
       Specifies  an  address  to  which  st_dyn_addr() returns a
       pointer to the data addressed by a dynamic section  entry.







DESCRIPTION    [Toc]    [Back]

       These  functions  are used to read dynamic section entries
       in an object file. The dynamic section is an array of  tag
       and value pairs providing information that is used to navigate
 and interpret additional  dynamic  load  information
       contained  in the object file. The dynamic section entries
       and other dynamic load information are  described  in  the
       Object  File/Symbol Table Format Specification. This document
 provides a complete list of dynamic section tags  and
       describes  how  each  tag's  corresponding value should be
       interpreted.  Used to iterate over all of the dynamic section
  entries.  These  functions  return an opaque dynamic
       section handle to the pdyn parameter.  You  can  use  this
       handle  as  an input argument in subsequent calls to other
       dynamic section access functions. (To  indicate  that  the
       iteration  over  the  dynamic sections has been completed,
       st_dyn_next() returns NULL to the pdyn  parameter.)   This
       function  returns  the  number of entries in the specified
       object's dynamic section to the pcount parameter.  Used to
       locate  a  dynamic section entry with a specific tag. This
       function returns an opaque dynamic section handle  to  the
       pdyn parameter. (To indicate that no matching dynamic section
 entry was found, st_dyn_find_tag()  returns  NULL  to
       the  pdyn  parameter.)   Used  to read the components of a
       dynamic section entry. The st_dyn_tag()  function  returns
       the  dynamic  section entry tag to the ptag parameter. The
       st_dyn_value() function returns the dynamic section  entry
       value  to  the pvalue parameter. The dynamic section entry
       value may be a constant or a link-time address, or it  may
       be unused.  If the specified dynamic section entry's value
       is a link-time address, this  function  returns  a  corresponding
 buffer pointer to the addr parameter.  Otherwise,
       NULL is returned to the addr parameter. The buffer pointer
       can  be used to access the file data that is referenced by
       the dynamic section entry.  The  format  of  the  data  is
       determined by the dynamic section entry tag.

RETURN VALUES    [Toc]    [Back]

       All  functions  indicate success by returning a value of 0
       (zero). A positive return value is an errno value  from  a
       system call. A negative return value is a library error or
       informational code. The library codes  are  documented  in
       st.h.

       Return  parameters  are  set to 0 when an error occurs. An
       exception to this is the case in which  an  invalid  input
       parameter is passed.  In such cases, the return parameters
       will be unchanged. A non-zero return status is the  recommended
  method  for detecting an error return from a libst
       function.

EXAMPLES    [Toc]    [Back]

       The following program illustrates how to  use  libst  routines
  to  read  dynamic section data. This sample program
       shows an  algorithm  for  reading  and  displaying  shared
       library dependency information.

       This  example  has  been  simplified for illustration purposes.
 Return status should be tested after each  function
       call.  See  st_strerror(3) for an example of return status
       testing.

       #include "st.h" #include "coff_dyn.h"

       main(int argc, char **argv){
           st_status_t    s;         /* error status */
           st_obj_t       *obj;      /* object handle */
           st_dynscn_t    pdyn;      /* dynamic entry */
           Coff_Lib       *llib;     /* library list */
           int            llibno;    /* # of libraries */
           char           *dynstr;   /* dynamic strings */
           unsigned long  val;
           unsigned long  addr;
           int            i;

           s = st_obj_open(&obj, argv[1], ST_RDONLY);

           /* Find dynamic section entry for the list of
            * shared library dependencies.
            */
           s = st_dyn_find_tag(obj, DT_LIBLIST, &pdyn);
           if (!pdyn) {
               printf("%s has no shared library dependencies\n",
                      argv[1]);
               exit(0);
           }

           /* Get a pointer to the list of shared library
            * dependencies.
            */
           st_dyn_addr(obj, pdyn, &addr);
           llib = (Coff_Lib *)addr;

           /* Get the number of entries in the list. */
           st_dyn_find_tag(obj, DT_LIBLISTNO, &pdyn);
           st_dyn_value(obj, pdyn, &val);
           llibno = val;

           /* Get a pointer to the dynamic string table. */
           st_dyn_find_tag(obj, DT_STRTAB, &pdyn);
           st_dyn_addr(obj, pdyn, &addr);
           dynstr = (char *)addr;

           /* Print out the library dependency names. */
           for (i = 0; i < llibno; i++) {
               printf("%s\n", &dynstr[llib[i].l_name]);
           } }

FILES    [Toc]    [Back]

       Header file that contains  all  definitions  and  function
       prototypes for libst.a functions Header file that contains
       definitions for dynamic section tag values

SEE ALSO    [Toc]    [Back]

      
      
       Functions: libst_intro(3), st_obj_open(3), st_str_error(3)

       Programmer's  Guide: Use a web browser such as netscape(1)
       to access the Developers' Toolkit  Supplement  edition  of
       the            Programmer's            Guide            at
       file:/usr/share/doclib/dtk/guide/index.html



                                                  st_dyn_start(3)
[ Back ]
 Similar pages
Name OS Title
ldd Tru64 List dynamic dependencies of executable files or shared objects
rqsall IRIX requickstarts out-of-sync ELF shared objects/executables on a system
dso IRIX Dynamic Shared Object (DSO)
ldd_pa HP-UX list dynamic dependencies of executable files or shared libraries
ldd HP-UX list dynamic dependencies of executable files or shared libraries
ldd_ia HP-UX list dynamic dependencies of executable files or shared libraries
ugidfw FreeBSD firewall-like access controls for file system objects
xlvShow IRIX shows information about xlv configuration and objects
lexgrog Linux parse header information in man pages
prtvtoc IRIX print disk volume header information
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service