/Modules/_ctypes/darwin/dlfcn.h

http://unladen-swallow.googlecode.com/ · C++ Header · 84 lines · 39 code · 11 blank · 34 comment · 0 complexity · b3a5981994b9fcd934e4ddef4d2d168f MD5 · raw file

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