]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/dll/include/boost/dll/shared_library_load_mode.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / dll / include / boost / dll / shared_library_load_mode.hpp
CommitLineData
7c673cae
FG
1// Copyright 2014 Renato Tegon Forti, Antony Polukhin.
2// Copyright 2015-2016 Antony Polukhin.
3//
4// Distributed under the Boost Software License, Version 1.0.
5// (See accompanying file LICENSE_1_0.txt
6// or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8#ifndef BOOST_DLL_SHARED_LIBRARY_MODE_HPP
9#define BOOST_DLL_SHARED_LIBRARY_MODE_HPP
10
11#include <boost/config.hpp>
12#include <boost/predef/os.h>
13#include <boost/predef/library/c.h>
14
15#if BOOST_OS_WINDOWS
16//#include <boost/detail/winapi/dll.hpp>
17#include <boost/detail/winapi/dll.hpp>
18#else
19# include <dlfcn.h>
20#endif
21
22#ifdef BOOST_HAS_PRAGMA_ONCE
23# pragma once
24#endif
25
26/// \file boost/dll/shared_library_load_mode.hpp
27/// \brief Contains only the boost::dll::load_mode::type enum and operators related to it.
28
29namespace boost { namespace dll { namespace load_mode {
30
31/*! Library load modes.
32*
33* Each of system family provides own modes. Flags not supported by a particular platform will be silently ignored.
34*
35* For a detailed description of platform specific options see:
36* <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx">Windows specific options</a>,
37* <a href="http://pubs.opengroup.org/onlinepubs/000095399/functions/dlopen.html">POSIX specific options</a>.
38*
39*/
40
41enum type {
42#ifdef BOOST_DLL_DOXYGEN
43 /*!
44 * Default open mode. See the \b Default: comments below to find out the flags that are enabled by default.
45 */
46 default_mode,
47
48 /*!
49 * \b Platforms: Windows
50 *
51 * \b Default: disabled
52 *
53 * If this value is used, and the executable module is a DLL, the system does
54 * not call DllMain for process and thread initialization and termination.
55 * Also, the system does not load additional executable modules that are
56 * referenced by the specified module.
57 *
58 * Note Do not use this value; it is provided only for backward compatibility.
59 * If you are planning to access only data or resources in the DLL, use
60 * LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE or LOAD_LIBRARY_AS_IMAGE_RESOURCE
61 * or both.
62 */
63 dont_resolve_dll_references,
64
65 /*!
66 * \b Platforms: Windows
67 *
68 * \b Default: disabled
69 *
70 * If this value is used, the system does not check AppLocker rules or
71 * apply Software Restriction Policies for the DLL.
72 */
73 load_ignore_code_authz_level,
74
75 /*!
76 * \b Platforms: Windows
77 *
78 * \b Default: disabled
79 *
80 * If this value is used and lpFileName specifies an absolute path,
81 * the system uses the alternate file search strategy.
82 *
83 * This value cannot be combined with any LOAD_LIBRARY_SEARCH flag.
84 */
85 load_with_altered_search_path,
86
87 /*!
88 * \b Platforms: POSIX
89 *
90 * \b Default: enabled
91 *
92 * Relocations shall be performed at an implementation-defined time, ranging
93 * from the time of the dlopen() call until the first reference to a given
94 * symbol occurs.
95 *
96 * Specifying RTLD_LAZY should improve performance on implementations
97 * supporting dynamic symbol binding as a process may not reference all of
98 * the functions in any given object. And, for systems supporting dynamic
99 * symbol resolution for normal process execution, this behavior mimics
100 * the normal handling of process execution.
101 */
102 rtld_lazy,
103
104 /*!
105 * \b Platforms: POSIX
106 *
107 * \b Default: disabled
108 *
109 * All necessary relocations shall be performed when the object is first
110 * loaded. This may waste some processing if relocations are performed for
111 * functions that are never referenced. This behavior may be useful for
112 * plugins that need to know as soon as an object is loaded that all
113 * symbols referenced during execution are available.
114 */
115 rtld_now,
116
117 /*!
118 * \b Platforms: POSIX
119 *
120 * \b Default: disabled
121 *
122 * The object's symbols shall be made available for the relocation
123 * processing of any other object. In addition, symbol lookup using
124 * dlopen(0, mode) and an associated dlsym() allows objects loaded
125 * with this mode to be searched.
126 */
127 rtld_global,
128
129 /*!
130 * \b Platforms: POSIX
131 *
132 * \b Default: enabled
133 *
134 * The object's symbols shall not be made available for the relocation
135 * processing of any other object.
136 *
137 * This is a default Windows behavior that can not be changed.
138 */
139 rtld_local,
140
141 /*!
142 * \b Platforms: POSIX (requires glibc >= 2.3.4)
143 *
144 * \b Default: disabled
145 *
146 * The object will use its own symbols in preference to global symbols
147 * with the same name contained in libraries that have already been loaded.
148 * This flag is not specified in POSIX.1-2001.
149 */
150 rtld_deepbind,
151
152 /*!
153 * \b Platforms: Windows, POSIX
154 *
155 * \b Default: disabled
156 *
157 * Append a platform specific extension and prefix to shared library filename before trying to load it.
158 * If load attempt fails, try to load with exactly specified name.
159 *
160 * \b Example:
161 * \code
162 * // Opens `./my_plugins/plugin1.dll` on Windows, `./my_plugins/libplugin1.so` on Linux, `./my_plugins/libplugin1.dylib` on MacOS.
163 * // If that fails, loads `./my_plugins/plugin1`
164 * boost::dll::shared_library lib("./my_plugins/plugin1", load_mode::append_decorations);
165 * \endcode
166 */
167 append_decorations,
168 /*!
169 * \b Platforms: Windows, POSIX
170 *
171 * \b Default: disabled
172 *
173 * Allow loading from system folders if path to library contains no parent path.
174 */
175 search_system_folders
176#elif BOOST_OS_WINDOWS
177 default_mode = 0,
178 dont_resolve_dll_references = boost::detail::winapi::DONT_RESOLVE_DLL_REFERENCES_,
179 load_ignore_code_authz_level = boost::detail::winapi::LOAD_IGNORE_CODE_AUTHZ_LEVEL_,
180 load_with_altered_search_path = boost::detail::winapi::LOAD_WITH_ALTERED_SEARCH_PATH_,
181 rtld_lazy = 0,
182 rtld_now = 0,
183 rtld_global = 0,
184 rtld_local = 0,
185 rtld_deepbind = 0,
186 append_decorations = 0x00800000,
187 search_system_folders = (append_decorations << 1)
188#else
189 default_mode = 0,
190 dont_resolve_dll_references = 0,
191 load_ignore_code_authz_level = 0,
192 load_with_altered_search_path = 0,
193 rtld_lazy = RTLD_LAZY,
194 rtld_now = RTLD_NOW,
195 rtld_global = RTLD_GLOBAL,
196 rtld_local = RTLD_LOCAL,
197
198#if BOOST_LIB_C_GNU < BOOST_VERSION_NUMBER(2,3,4)
199 rtld_deepbind = 0,
200#else
201 rtld_deepbind = RTLD_DEEPBIND,
202#endif
203
204 append_decorations = 0x00800000,
205 search_system_folders = (append_decorations << 1)
206#endif
207};
208
209
210/// Free operators for load_mode::type flag manipulation.
211BOOST_CONSTEXPR inline type operator|(type left, type right) BOOST_NOEXCEPT {
212 return static_cast<type>(
213 static_cast<unsigned int>(left) | static_cast<unsigned int>(right)
214 );
215}
216BOOST_CXX14_CONSTEXPR inline type& operator|=(type& left, type right) BOOST_NOEXCEPT {
217 left = left | right;
218 return left;
219}
220
221BOOST_CONSTEXPR inline type operator&(type left, type right) BOOST_NOEXCEPT {
222 return static_cast<type>(
223 static_cast<unsigned int>(left) & static_cast<unsigned int>(right)
224 );
225}
226BOOST_CXX14_CONSTEXPR inline type& operator&=(type& left, type right) BOOST_NOEXCEPT {
227 left = left & right;
228 return left;
229}
230
231BOOST_CONSTEXPR inline type operator^(type left, type right) BOOST_NOEXCEPT {
232 return static_cast<type>(
233 static_cast<unsigned int>(left) ^ static_cast<unsigned int>(right)
234 );
235}
236BOOST_CXX14_CONSTEXPR inline type& operator^=(type& left, type right) BOOST_NOEXCEPT {
237 left = left ^ right;
238 return left;
239}
240
241BOOST_CONSTEXPR inline type operator~(type left) BOOST_NOEXCEPT {
242 return static_cast<type>(
243 ~static_cast<unsigned int>(left)
244 );
245}
246
247}}} // boost::dll::load_mode
248
249#endif // BOOST_DLL_SHARED_LIBRARY_MODE_HPP