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

unload Subroutine

Purpose

Unloads a module.

Library

Standard C Library (libc.a)

Syntax

#include <sys/ldr.h>
int unload(FunctionPointer)
int (*FunctionPointer)( );

Description

The unload subroutine unloads the specified module and its dependents. The value returned by the load subroutine is passed to the unload subroutine as FunctionPointer.

If the program calling the unload subroutine was linked on 4.2 or a later release, the unload subroutine calls termination routines (fini routines) for the specified module and any of its dependents that are not being used by any other module.

The unload subroutine frees the storage used by the specified module only if the module is no longer in use. A module is in use as long as any other module that is in use imports symbols from it.

When a module is unloaded, any deferred resolution symbols that were bound to the module remain bound. These bindings create references to the module that cannot be undone, even with the unload subroutine.

Parameters

FunctionPointer Specifies the name of the function returned by the load subroutine.

Return Values

Upon successful completion, the unload subroutine returns a value of 0 , even if the module couldn't be unloaded because it is still in use.

Error Codes

If the unload subroutine fails, a value of -1 is returned, the program is not unloaded, and errno is set to indicate the error. errno may be set to one of the following:

EINVAL The FunctionPointer parameter does not correspond to a program loaded by the load subroutine.

Implementation Specifics

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

Related Information

The load subroutine, loadbind subroutine, loadquery subroutine, dlclose subroutine.

The ld command.

Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


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