[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

dlerror Subroutine

Purpose

Return 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.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The load subroutine, loadbind subroutine, loadquery subroutine, unload subroutine, dlopen subroutine, dlclose subroutine, dlsym subroutine.

The ld command.

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


[ Previous | Next | Contents | Glossary | Home | Search ]