blob: a2afc3eeb84794bd27ce338c839d731484c20b7c [file] [log] [blame]
Thomas Hellerd4c93202006-03-08 19:35:11 +00001/*
2Copyright (c) 2002 Jorge Acereda <jacereda@users.sourceforge.net> &
3 Peter O'Gorman <ogorman@users.sourceforge.net>
4
5Portions may be copyright others, see the AUTHORS file included with this
6distribution.
7
8Maintained by Peter O'Gorman <ogorman@users.sourceforge.net>
9
10Bug Reports and other queries should go to <ogorman@users.sourceforge.net>
11
12Permission is hereby granted, free of charge, to any person obtaining
13a copy of this software and associated documentation files (the
14"Software"), to deal in the Software without restriction, including
15without limitation the rights to use, copy, modify, merge, publish,
16distribute, sublicense, and/or sell copies of the Software, and to
17permit persons to whom the Software is furnished to do so, subject to
18the following conditions:
19
20The above copyright notice and this permission notice shall be
21included in all copies or substantial portions of the Software.
22
23THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30*/
31#ifndef _DLFCN_H_
32#define _DLFCN_H_
33
34#include <AvailabilityMacros.h>
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40
41/*
42 * Structure filled in by dladdr().
43 */
44
45typedef struct dl_info {
46 const char *dli_fname; /* Pathname of shared object */
47 void *dli_fbase; /* Base address of shared object */
48 const char *dli_sname; /* Name of nearest symbol */
49 void *dli_saddr; /* Address of nearest symbol */
50} Dl_info;
51
52
53#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_2
54#warning CTYPES_DARWIN_DLFCN
55#define CTYPES_DARWIN_DLFCN
56extern void * (*ctypes_dlopen)(const char *path, int mode);
57extern void * (*ctypes_dlsym)(void * handle, const char *symbol);
58extern const char * (*ctypes_dlerror)(void);
59extern int (*ctypes_dlclose)(void * handle);
60extern int (*ctypes_dladdr)(const void *, Dl_info *);
61#else
62extern void * dlopen(const char *path, int mode);
63extern void * dlsym(void * handle, const char *symbol);
64extern const char * dlerror(void);
65extern int dlclose(void * handle);
66extern int dladdr(const void *, Dl_info *);
67#endif
68
69#define RTLD_LAZY 0x1
70#define RTLD_NOW 0x2
71#define RTLD_LOCAL 0x4
72#define RTLD_GLOBAL 0x8
73#define RTLD_NOLOAD 0x10
74#define RTLD_NODELETE 0x80
75
76/* These are from the Mac OS X 10.4 headers */
77#define RTLD_NEXT ((void *) -1) /* Search subsequent objects. */
78#define RTLD_DEFAULT ((void *) -2) /* Use default search algorithm. */
79
80#ifdef __cplusplus
81}
82#endif
83
84#endif /* _DLFCN_H_ */