/Modules/_ctypes/darwin/README

http://unladen-swallow.googlecode.com/ · #! · 95 lines · 70 code · 25 blank · 0 comment · 0 complexity · 8e7c0abe4a0c29000cdeb32f3f49b9b0 MD5 · raw file

  1. dlcompat for Darwin
  2. =========================
  3. This is dlcompat, a small library that emulates the dlopen()
  4. interface on top of Darwin's dyld API.
  5. dlcompat allows loading a ".dylib" library (as long as the RTLD_LOCAL
  6. flag isn't passed to dlopen()). It can be configured to yield a warning
  7. when trying to close it (dynamic libraries cannot currently be unloaded).
  8. It automatically searches for modules in several directories when no
  9. absolute path is specified and the module is not found in the current
  10. directory.
  11. The paths searched are those specified in the environment variables
  12. LD_LIBRARY_PATH and DYLD_LIBRARY_PATH plus /lib, /usr/local/lib and
  13. /usr/lib or the path specified in the environment variable
  14. DYLD_FALLBACK_LIBRARY_PATH.
  15. In the default install the behavior of dlsym is to automatically prepend
  16. an underscore to passed in symbol names, this allows easier porting of
  17. applications which were written specifically for ELF based lifeforms.
  18. Installation
  19. --------------
  20. Type:
  21. ./configure
  22. make
  23. sudo make install
  24. This will compile the source file, generate both a static and shared
  25. library called libdl and install it into /usr/local/lib. The header
  26. file dlfcn.h will be installed in /usr/local/include.
  27. If you want to place the files somewhere else, run
  28. make clean
  29. ./configure --prefix=<prefix>
  30. make
  31. sudo make install
  32. where <prefix> is the hierarchy you want to install into, e.g. /usr
  33. for /usr/lib and /usr/include (_NOT_ recommended!).
  34. To enable debugging output (useful for me), run
  35. make clean
  36. ./configure --enable-debug
  37. make
  38. sudo make install
  39. If you want old dlcompat style behavior of not prepending the underscore
  40. on calls to dlsym then type:
  41. make clean
  42. ./configure --enable-fink
  43. make
  44. sudo make install
  45. Usage
  46. -------
  47. Software that uses GNU autoconf will likely check for a library called
  48. libdl, that's why I named it that way. For software that doesn't find
  49. the library on its own, you must add a '-ldl' to the appropriate
  50. Makefile (or environment) variable, usually LIBS.
  51. If you installed dlcompat into a directory other than /usr/local/lib,
  52. you must tell the compiler where to find it. Add '-L<prefix>/lib' to
  53. LDFLAGS (or CFLAGS) and '-I<prefix>/include' to CPPFLAGS (or CFLAGS).
  54. Notes
  55. -----
  56. If you are writing new software and plan to have Mac OX X compatibility you
  57. should look at the dyld api's in /usr/include/mach-o/dyld.h, rather than
  58. using dlcompat, using the native api's is the supported method of loading
  59. dynamically on Mac OS X, if you want an small example, look at dlfcn_simple.c,
  60. which should help get you started.
  61. Also note that the functions in dlcompat are not thread safe, and while it is not
  62. POSIX spec compliant, it is about as close to compliance as it is going to get though.
  63. You can always get the latest version from opendarwin cvs:
  64. cvs -d :pserver:anonymous@anoncvs.opendarwin.org:/cvs/od login
  65. cvs -z3 -d :pserver:anonymous@anoncvs.opendarwin.org:/cvs/od \
  66. co -d dlcompat proj/dlcompat
  67. It is hoped that this library will be useful, and as bug free as possible, if you find
  68. any bugs please let us know about them so they can be fixed.
  69. Please send bug reports to Peter O'Gorman <ogorman@users.sourceforge.net>
  70. Thanks.