DLOPEN_PREFLIGHT(3) Library Functions Manual DLOPEN_PREFLIGHT(3)

dlopen_preflightpreflight the load of a dynamic library or bundle

#include <dlfcn.h>

bool
dlopen_preflight(const char* path);

() examines the mach-o file specified by path. It checks if the file and libraries it depends on are all compatible with the current process. That is, they contain the correct architecture and are not otherwise ABI incompatible.

() was created for the PowerPC to Intel transition for use by apps with plugins that the user chooses to load. The app could use dlopen_preflight() to show only loadable plugins to the user (such as in a menu).

This is potentially an expensive call because it may internally do the same as dlopen/dlclose. Only use dlopen_preflight() if you need to show the user a list of potentially loadable plugins.

() was first available in Mac OS X 10.5.

dlopen_preflight() uses the same steps as () to find a compatible mach-o file.

dlopen_preflight() returns true on if the mach-o file is compatible. If the file is not compatible, it returns false and sets an error string that can be examined with dlerror().

dlopen(3) dlerror(3)

May 11, 2020 Mac OS X 12