-.Dd Nov 6, 2006
+.Dd Aug 7, 2012
.Os
.Dt DLOPEN 3
.Sh NAME
.Fn dlopen
searches for a compatible Mach-O file in the directories specified by a set of environment variables and
the process's current working directory.
-When set, the environment variables must contain a colon-separated list of directory paths,
-which can be absolute or relative to the current working directory. The environment variables
-are LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, and DYLD_FALLBACK_LIBRARY_PATH.
-The first two variables have no default value. The default value of DYLD_FALLBACK_LIBRARY_PATH
-is $HOME/lib;/usr/local/lib;/usr/lib.
-.Fn dlopen
-searches the directories specified in the environment variables in the order they are listed.
+When set, the environment variables contain a colon-separated list of directory paths,
+which can be absolute or relative to the current working directory.
.Pp
When
.Fa path
-doesn't contain a slash character (i.e. it is just a leaf name),
+does not contain a slash character (i.e. it is just a leaf name),
.Fn dlopen
-searches the following the following until it finds a compatible Mach-O file: $LD_LIBRARY_PATH,
+searches the following until it finds a compatible Mach-O file: $LD_LIBRARY_PATH,
$DYLD_LIBRARY_PATH, current working directory, $DYLD_FALLBACK_LIBRARY_PATH.
.Pp
When
.Fa path
-contains a slash (i.e. a full path or a partial path)
+looks like a framework path (e.g. /stuff/foo.framework/foo),
.Fn dlopen
-searches the following the following until it finds a compatible Mach-O file:
-$DYLD_LIBRARY_PATH (with leaf name from
+searches the following until it finds a compatible Mach-O file:
+$DYLD_FRAMEWORK_PATH (with framework partial path from
.Fa path
-), current working directory (for partial paths), $DYLD_FALLBACK_LIBRARY_PATH
-(with leaf name from
+), then the supplied
+.Fa path
+(using current working directory for relative paths), then
+$DYLD_FALLBACK_FRAMEWORK_PATH (with framework partial path from
.Fa path
).
.Pp
+When
+.Fa path
+contains a slash but is not a framework path (i.e. a full path or a partial path to a dylib),
+.Fn dlopen
+searches the following until it finds a compatible Mach-O file:
+$DYLD_LIBRARY_PATH (with leaf name from
+.Fa path
+), then the supplied
+.Fa path
+(using current working directory for relative paths), then
+$DYLD_FALLBACK_LIBRARY_PATH (with leaf name from
+.Fa path
+).
+.Pp
+Note: If DYLD_FALLBACK_LIBRARY_PATH is not set, dlopen operates as if
+DYLD_FALLBACK_LIBRARY_PATH was set to $HOME/lib:/usr/local/lib:/usr/lib.
+.Pp
+Note: If DYLD_FALLBACK_FRAMEWORK_PATH is not set, dlopen operates as if
+DYLD_FALLBACK_FRAMEWORK_PATH was set to $HOME/Library/Frameworks:/Library/Frameworks:/Network/Library/Frameworks:/System/Library/Frameworks.
+.Pp
Note: There are no configuration files to control dlopen searching.
.Pp
-Note: If the main executable is a set[ug]id binary, then all environment variables are ignored, and only a full path can be used.
+Note: If the main executable is a set[ug]id binary or codesigned with entitlements,
+then all environment variables are ignored, and only a full path can be used.
.Pp
Note: Mac OS X uses "universal" files to combine 32-bit and 64-bit libraries. This means there are no separate 32-bit and 64-bit search paths.
.Pp
.Fn dlopen
fails, it returns a null pointer, and sets an error condition which may be interrogated with
.Fn dlerror .
-.Sh AUTHORS
-Mac OS X 10.3 incorporated the dlcompat package written by Jorge Acereda <jacereda@users.sourceforge.net>
-and Peter O'Gorman <ogorman@users.sourceforge.net>.
-.Pp
-In Mac OS X 10.4, dlopen was rewritten to be a native part of dyld.
.Pp
.Sh SEE ALSO
.Xr dlopen_preflight 3
.Xr dlclose 3
.Xr dlsym 3
.Xr dlerror 3
-.Xr dyld 3
+.Xr dyld 1
.Xr ld 1