| Home | Libraries | People | FAQ | More

## Type type

boost::dll::load_mode::type

## Synopsis

    // In header: <boost/dll/shared_library_load_mode.hpp>

    enum type { default_mode, dont_resolve_dll_references,
                load_ignore_code_authz_level, load_with_altered_search_path,
                rtld_lazy, rtld_now, rtld_global, rtld_local, rtld_deepbind,
                append_decorations, search_system_folders };

## Description

Library load modes.

Each of system family provides own modes. Flags not supported by a particular platform will be silently ignored.

For a detailed description of platform specific options see: Windows specific options, POSIX specific options.

`default_mode`

  Default open mode. See the Default: comments below to find out the flags that are enabled by default.

`dont_resolve_dll_references`

  Platforms: Windows

  Default: disabled

  If this value is used, and the executable module is a DLL, the system does not call DllMain for process and thread initialization and termination. Also, the system does not load additional executable modules that are referenced by the specified module.

  Note Do not use this value; it is provided only for backward compatibility. If you are planning to access only data or resources in the DLL, use LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE or LOAD_LIBRARY_AS_IMAGE_RESOURCE or both.

`load_ignore_code_authz_level`

  Platforms: Windows

  Default: disabled

  If this value is used, the system does not check AppLocker rules or apply Software Restriction Policies for the DLL.

`load_with_altered_search_path`

  Platforms: Windows

  Default: disabled

  If this value is used and lpFileName specifies an absolute path, the system uses the alternate file search strategy.

  This value cannot be combined with any LOAD_LIBRARY_SEARCH flag.

`rtld_lazy`

  Platforms: POSIX

  Default: enabled

  Relocations shall be performed at an implementation-defined time, ranging from the time of the dlopen() call until the first reference to a given symbol occurs.

  Specifying RTLD_LAZY should improve performance on implementations supporting dynamic symbol binding as a process may not reference all of the functions in any given object. And, for systems supporting dynamic symbol resolution for normal process execution, this behavior mimics the normal handling of process execution.

`rtld_now`

  Platforms: POSIX

  Default: disabled

  All necessary relocations shall be performed when the object is first loaded. This may waste some processing if relocations are performed for functions that are never referenced. This behavior may be useful for plugins that need to know as soon as an object is loaded that all symbols referenced during execution are available.

`rtld_global`

  Platforms: POSIX

  Default: disabled

  The object's symbols shall be made available for the relocation processing of any other object. In addition, symbol lookup using dlopen(0, mode) and an associated dlsym() allows objects loaded with this mode to be searched.

`rtld_local`

  Platforms: POSIX

  Default: enabled

  The object's symbols shall not be made available for the relocation processing of any other object.

  This is a default Windows behavior that can not be changed.

`rtld_deepbind`

  Platforms: POSIX (requires glibc >= 2.3.4)

  Default: disabled

  The object will use its own symbols in preference to global symbols with the same name contained in libraries that have already been loaded. This flag is not specified in POSIX.1-2001.

`append_decorations`

  Platforms: Windows, POSIX

  Default: disabled

  Append a platform specific extension and prefix to shared library filename before trying to load it. If load attempt fails, try to load with exactly specified name.

  Example:

      // Opens `./my_plugins/plugin1.dll` on Windows, `./my_plugins/libplugin1.so` on Linux, `./my_plugins/libplugin1.dylib` on MacOS.
      // If that fails, loads `./my_plugins/plugin1`
      boost::dll::shared_library lib("./my_plugins/plugin1", load_mode::append_decorations);

`search_system_folders`

  Platforms: Windows, POSIX

  Default: disabled

  Allow loading from system folders if path to library contains no parent path.