int dlclose(void *Handle);
int shl_unload(void *Handle);
Le résultat est inutile.
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
/*
#include <dl.h>
*/
void *Handle;
void (*Procedure)(void);
...
Handle=dlopen("/tmp/libessai.a", RTLD_NOW);
/*
Handle=shl_load("/tmp/libessai.sl", BIND_IMMEDIATE);
*/
if (!Handle)
{
...
}
...
Procedure=(void (*)(void))dlsym(Handle, "MaProcedure");
/*
Procedure=NULL;
shl_findsym(&Handle, "MaProcedure", TYPE_UNDEFINED, &Procedure);
*/
if (!Procedure)
{
...
}
...
(*Procedure)();
...
if (dlclose(Handle)==-1)
/*
if (shl_unload(HandleBibliotheque)==-1)
*/
{
...
}
...
Sur Hewlett Packard :
Le résultat est -1 en cas d'erreur.