dlfcn.h revision 2976cf85
1/*
2 * Copyright 2003-2012 Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _DLFCN_H
6#define	_DLFCN_H
7
8
9#include <sys/types.h>
10
11
12#define RTLD_LAZY	0	/* relocations are performed as needed */
13#define RTLD_NOW	1	/* the file gets relocated at load time */
14#define RTLD_LOCAL	0	/* symbols are not available for relocating any other object */
15#define RTLD_GLOBAL	2	/* all symbols are available */
16
17/* not-yet-POSIX extensions (dlsym() handles) */
18#define RTLD_DEFAULT	((void*)0)
19	/* find the symbol in the global scope */
20#define RTLD_NEXT		((void*)-1L)
21	/* find the next definition of the symbol */
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* This is a gnu extension for the dladdr function */
28typedef struct {
29   const char *dli_fname;  /* Filename of defining object */
30   void *dli_fbase;        /* Load address of that object */
31   const char *dli_sname;  /* Name of nearest lower symbol */
32   void *dli_saddr;        /* Exact value of nearest symbol */
33} Dl_info;
34
35extern int	dlclose(void *image);
36extern char	*dlerror(void);
37extern void	*dlopen(const char *path, int mode);
38extern void *dlsym(void *image, const char *symbolName);
39extern int dladdr(const void *addr, Dl_info *info);
40
41#ifdef __cplusplus
42}
43#endif
44
45#endif /* _DLFCN_H */
46