1 /* 2 Copyright (c) 2002 Jorge Acereda <jacereda@users.sourceforge.net> & 3 Peter O'Gorman <ogorman@users.sourceforge.net> 4 5 Portions may be copyright others, see the AUTHORS file included with this 6 distribution. 7 8 Maintained by Peter O'Gorman <ogorman@users.sourceforge.net> 9 10 Bug Reports and other queries should go to <ogorman@users.sourceforge.net> 11 12 Permission is hereby granted, free of charge, to any person obtaining 13 a copy of this software and associated documentation files (the 14 "Software"), to deal in the Software without restriction, including 15 without limitation the rights to use, copy, modify, merge, publish, 16 distribute, sublicense, and/or sell copies of the Software, and to 17 permit persons to whom the Software is furnished to do so, subject to 18 the following conditions: 19 20 The above copyright notice and this permission notice shall be 21 included in all copies or substantial portions of the Software. 22 23 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 27 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 28 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 29 WITH 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 37 extern "C" { 38 #endif 39 40 41 /* 42 * Structure filled in by dladdr(). 43 */ 44 45 typedef 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 56 extern void * (*ctypes_dlopen)(const char *path, int mode); 57 extern void * (*ctypes_dlsym)(void * handle, const char *symbol); 58 extern const char * (*ctypes_dlerror)(void); 59 extern int (*ctypes_dlclose)(void * handle); 60 extern int (*ctypes_dladdr)(const void *, Dl_info *); 61 #else 62 extern void * dlopen(const char *path, int mode); 63 extern void * dlsym(void * handle, const char *symbol); 64 extern const char * dlerror(void); 65 extern int dlclose(void * handle); 66 extern 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_ */ 85