dlclose

Gamma: Version 4.0
Prev |  | Next

# `dlclose`

`dlclose` -- closes an open dynamic library.

## Syntax

    dlclose (handle)

## Arguments

`handle`

  The "handle" returned by `dlopen`.

## Returns

0 when successful, else -1.

## Description

This function is a wrapper for the `dlclose` shell command. Each call decrements the link count in the dl library created by `dlopen`. When this count reaches zero and no other loaded libraries use symbols in it, the library is unloaded.

If the library exports a routine named `_fini`, that will be called just before the library is unloaded.

## Example

        Gamma> dlopen("libform.so",RTLD_NOW|RTLD_GLOBAL);
        134940024
        Gamma> a = dlopen("libform.so",RTLD_NOW|RTLD_GLOBAL);
        134940024
        Gamma> dlclose(a);
        0
        Gamma> dlclose(a);
        0
        Gamma> dlclose(a);
        -1
        Gamma>

## See Also

`dlopen`

Prev | Home | Next
`ClearAutoLoad` | Up | `dlerror`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.