Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dlsym(3) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

rld(1)

ld(1)

dlopen(3)  —  Subroutines

Digital

NAME

dlopen, dlsym, dlclose, dlerror − dynamically load libraries

SYNOPSIS

#include <stdio.h>
#include <dlfcn.h> }

void ∗dlopen (filename, mode)
char ∗filename;
int mode;

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

void dlclose (handle)
void ∗handle;

char ∗dlerror (void)

DESCRIPTION

The dlopen function provides an interface to the dynamic library loader to allow shared libraries to be loaded and called at runtime.  The dlopen function attempts to load filename, in the address space of the process, resolving symbols as appropriate. Any libraries that filename depends upon are also loaded. 

If mode is RTLD_LAZY, then the runtime loader does symbol resolution only as needed.  Typically, this means that the first call to a function in the newly loaded library will cause the resolution of the address of that function to occur. If mode is RTDL_NOW, then the runtime loader must do all symbol binding during the dlopen call.  dlopen returns a handle that is used by dlsym or dlclose call. If there is an error, a NULL pointer is returned. 

If a NULL filename is specified, dlopen returns a handle for the main executable, which allows access to dynamic symbols in the running program. 

The dlsym frunction returns the address of the symbol name found in the shared library corresponding to handle.  If the symbol is not found, a NULL pointer is returned. 

The dlclose function deallocates the address space for the library corresponding to handle.  If any user function continues to call a symbol resolved in the address space of a library that has been since been deallocated by dlclose, the results are undefined. 

The dlerror function returns a string describing the last error that occured from a call to dlopen, dlclose or dlsym. 

RELATED INFORMATION

rld(1), ld(1). 
 

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