[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

dlerror Subroutine

Purpose

Returns a pointer to information about the last dlopen, dlsym, or dlclose error.

Syntax

#include <dlfcn.h>

char *dlerror(void);

Description

The dlerror subroutine is used to obtain information about the last error that occurred in a dynamic loading routine (that is, dlopen , dlsym , or dlclose ). The returned value is a pointer to a null-terminated string without a final newline. Once a call is made to this function, subsequent calls without any intervening dynamic loading errors will return NULL.

Applications can avoid calling the dlerror subroutine, in many cases, by examining errno after a failed call to a dynamic loading routine. If errno is ENOEXEC, the dlerror subroutine will return additional information. In all other cases, dlerror will return the string corresponding to the value of errno.

The dlerror function may invoke loadquery to ascertain reasons for a failure. If a call is made to load or unload between calls to dlopen and dlerror, incorrect information may be returned.

Return Values

A pointer to a static buffer is returned; a NULL value is returned if there has been no error since the last call to dlerror. Applications should not write to this buffer; they should make a copy of the buffer if they wish to preserve the buffer's contents.

Related Information

The load (load Subroutine) subroutine, loadbind (loadbind Subroutine) subroutine, loadquery (loadquery Subroutine)subroutine, unload subroutine, dlopen (dlopen Subroutine) subroutine, dlclose (dlclose Subroutine) subroutine, dlsym (dladdr Subroutine) subroutine.

The ld command.

The Shared Libraries and Shared Memory Overview and Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]