#include <dlfcn.h>

dlfcn.h

Based on the dlcompat work done by: Jorge Acereda <jacereda@users.sourceforge.net> & Peter O'Gorman <ogorman@users.sourceforge.net>
includes: sys/cdefs.h, stdbool.h, Availability.h
11 macros · 6 functions · 1 struct · 1 typedef

structdl_info

Structure filled in by dladdr().
size 32, align 8
const char *dli_fnamePathname of shared object
void *dli_fbaseBase address of shared object
const char *dli_snameName of nearest symbol
void *dli_saddrAddress of nearest symbol

typedefDl_info

typedef struct dl_info Dl_info;

functiondladdr

extern int dladdr(const void *, Dl_info *)
man page · September 24, 2004
dladdr(3) — find the image containing a given address

functiondlclose

__DYLDDL_UNAVAILABLE
extern int dlclose(void * __handle)
man page · Feb 8, 2024
dlclose(3) — close a dynamic library or bundle

functiondlerror

__DYLDDL_UNAVAILABLE
extern char * dlerror(void)
man page · April 17, 2006
dlerror(3) — get diagnostic information

functiondlopen

__DYLDDL_UNAVAILABLE
extern void * dlopen(const char * __path, int __mode)
man page · Feb 8, 2024
dlopen(3) — load and link a dynamic library or bundle

functiondlsym

__DYLDDL_DLSYM_UNAVAILABLE
extern void * dlsym(void * __handle, const char * __symbol)
man page · August 28, 2008
dlsym(3) — get address of a symbol

functiondlopen_preflight

__API_AVAILABLE(macos(10.5), ios(2.0)) __DYLDDL_UNAVAILABLE
extern bool dlopen_preflight(const char* __path)
man page · May 11, 2020
dlopen_preflight(3) — preflight the load of a dynamic library or bundle

macroRTLD_LAZY

#define RTLD_LAZY 0x1

macroRTLD_NOW

#define RTLD_NOW 0x2

macroRTLD_LOCAL

#define RTLD_LOCAL 0x4

macroRTLD_GLOBAL

#define RTLD_GLOBAL 0x8

macroRTLD_NOLOAD

#define RTLD_NOLOAD 0x10

macroRTLD_NODELETE

#define RTLD_NODELETE 0x80

macroRTLD_FIRST

#define RTLD_FIRST 0x100
Mac OS X 10.5 and later

macroRTLD_NEXT

Special handle arguments for dlsym().
#define RTLD_NEXT ((void *) -1)
Search subsequent objects.

macroRTLD_DEFAULT

#define RTLD_DEFAULT ((void *) -2)
Use default search algorithm.

macroRTLD_SELF

#define RTLD_SELF ((void *) -3)
Search this and subsequent objects (Mac OS X 10.5 and later)

macroRTLD_MAIN_ONLY

#define RTLD_MAIN_ONLY ((void *) -5)
Search main executable only (Mac OS X 10.5 and later)