dlcompat for Darwin
=========================

This is dlcompat, a small library that emulates the dlopen()
interface on top of Darwin's dyld API.

Unlike dlopen.c in cctools, this allows loading a ".dylib" 
library (as long as the RTLD_LOCAL flag isn't passed to dlopen()). It can 
be configured to yield a warning when trying to close it (dynamic 
libraries cannot be unloaded).

It automatically searches for modules in several directories (taken
from the environment variables DYLD_LIBRARY_PATH and LD_LIBRARY_PATH,
plus /usr/lib and /lib) when no absolute path is specified and the
module is not found in the current directory.

Installation
--------------
As root, type:

  make install

This will compile the source file, generate both a static and shared
library called libdl and install it into /usr/local/lib. The header
file dlfcn.h will be installed in /usr/local/include.

If you want to place the files somewhere else, run

  make clean
  make install prefix=<prefix>

where <prefix> is the hierarchy you want to install into, e.g. /usr
for /usr/lib and /usr/include (_NOT_ recommended!).

To enable warnings output (useful for people porting packages), run

  make clean
  make DEBUG=1
  make install

To enable debugging output, run

  make clean
  make debug
  make install

Usage
-------
Software that uses GNU autoconf will likely check for a library called
libdl, that's why I named it that way. For software that doesn't find
the library on its own, you must add a '-ldl' to the appropriate
Makefile (or environment) variable, usually LIBS.

If you installed dlcompat into a directory other than /usr/local/lib,
you must tell the compiler where to find it. Add '-L<prefix>/lib' to
LDFLAGS (or CFLAGS) and '-I<prefix>/include' to CPPFLAGS (or CFLAGS).

