79 lines
2.4 KiB
C
79 lines
2.4 KiB
C
#ifndef _DLFCN_H
|
|
#define _DLFCN_H 1
|
|
|
|
#include <stdint.h>
|
|
|
|
enum DLOPEN_FLAGS
|
|
{
|
|
/*
|
|
Perform lazy binding. Resolve symbols only as the code
|
|
that references them is executed. If the symbol is never
|
|
referenced, then it is never resolved. (Lazy binding is
|
|
performed only for function references; references to
|
|
variables are always immediately bound when the shared
|
|
object is loaded.).
|
|
*/
|
|
RTLD_LAZY,
|
|
|
|
/*
|
|
If this value is specified, or the environment variable
|
|
LD_BIND_NOW is set to a nonempty string, all undefined
|
|
symbols in the shared object are resolved before dlopen()
|
|
returns. If this cannot be done, an error is returned.
|
|
|
|
Zero or more of the following values may also be ORed in flags:
|
|
*/
|
|
RTLD_NOW,
|
|
|
|
/*
|
|
The symbols defined by this shared object will be made
|
|
available for symbol resolution of subsequently loaded
|
|
shared objects.
|
|
*/
|
|
RTLD_GLOBAL,
|
|
|
|
/*
|
|
This is the converse of RTLD_GLOBAL, and the default if
|
|
neither flag is specified. Symbols defined in this shared
|
|
object are not made available to resolve references in
|
|
subsequently loaded shared objects.
|
|
*/
|
|
RTLD_LOCAL,
|
|
|
|
/*
|
|
Do not unload the shared object during dlclose().
|
|
Consequently, the object's static and global variables are
|
|
not reinitialized if the object is reloaded with dlopen()
|
|
at a later time.
|
|
*/
|
|
RTLD_NODELETE,
|
|
|
|
/*
|
|
Don't load the shared object. This can be used to test if
|
|
the object is already resident (dlopen() returns NULL if it
|
|
is not, or the object's handle if it is resident). This
|
|
flag can also be used to promote the flags on a shared
|
|
object that is already loaded. For example, a shared
|
|
object that was previously loaded with RTLD_LOCAL can be
|
|
reopened with RTLD_NOLOAD | RTLD_GLOBAL.
|
|
*/
|
|
RTLD_NOLOAD,
|
|
|
|
/*
|
|
Place the lookup scope of the symbols in this shared object
|
|
ahead of the global scope. This means that a self-
|
|
contained object will use its own symbols in preference to
|
|
global symbols with the same name contained in objects that
|
|
have already been loaded.
|
|
*/
|
|
RTLD_DEEPBIND
|
|
};
|
|
|
|
void *dlopen(const char *filename, int flag);
|
|
const char *dlerror(void);
|
|
void *dlsym(void *handle, char *symbol);
|
|
int dlclose(void *handle);
|
|
|
|
|
|
#endif // _DLFCN_H
|