Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dlsym(3x) — Atari System V ue12

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dlerror(3X)

dlopen(3X)

dlsym(3X)





   dlsym(3X)           (C Programming Language Utilities)            dlsym(3X)


   NAME
         dlsym - get the address of a symbol in shared object

   SYNOPSIS
         cc [flag ...] file ...  -ldl [library ...]

         #include <dlfcn.h>

         void *dlsym(void *handle, char *name);

   DESCRIPTION
         dlsym allows a process to obtain the address of a symbol defined
         within a shared object previously opened by dlopen(3X).  handle is a
         value returned by a call to dlopen; the corresponding shared object
         must not have been closed using dlclose(3X).  name is the symbol's
         name as a character string.  dlsym will search for the named symbol
         in all shared objects loaded automatically as a result of loading the
         object referenced by handle [see dlopen(3X)].

   DIAGNOSTICS
         If handle does not refer to a valid object opened by dlopen, or if
         the named symbol cannot be found within any of the objects associated
         with handle, dlsym will return NULL.  More detailed diagnostic
         information will be available through dlerror(3X).

   EXAMPLES
         The following example shows how one can use dlopen and dlsym to
         access either function or data objects.  For simplicity, error
         checking has been omitted.

              void *handle;
              int i, *iptr;
              int (*fptr)(int);

              /* open the needed object */
              handle = dlopen("/usr/mydir/libx.so", RTLDLAZY);

              /* find address of function and data objects */
              fptr = (int (*)(int))dlsym(handle, "somefunction");

              iptr = (int *)dlsym(handle, "intobject");

              /* invoke function, passing value of integer as a parameter */

              i = (*fptr)(*iptr);

   SEE ALSO
         dlerror(3X), dlopen(3X), dlsym(3X).





   7/91                                                                 Page 1





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026