1 //! The change log.
2 
3 /// Release 0.7.0 (2021-01-31)
4 ///
5 /// ## Breaking changes
6 ///
7 /// ### Loading functions are now `unsafe`
8 ///
9 /// A number of associated methods involved in loading a library were changed to
10 /// be `unsafe`. The affected functions are: [`Library::new`], [`os::unix::Library::new`],
11 /// [`os::unix::Library::open`], [`os::windows::Library::new`],
12 /// [`os::windows::Library::load_with_flags`]. This is the most prominent breaking change in this
13 /// release and affects majority of the users of `libloading`.
14 ///
15 /// In order to see why it was necessary, consider the following snippet of C++ code:
16 ///
17 /// ```c++
18 /// #include <vector>
19 /// #include <iostream>
20 ///
21 /// static std::vector<unsigned int> UNSHUU = { 1, 2, 3 };
22 ///
23 /// int main() {
24 ///     std::cout << UNSHUU[0] << UNSHUU[1] << UNSHUU[2] << std::endl; // Prints 123
25 ///     return 0;
26 /// }
27 /// ```
28 ///
29 /// The `std::vector` type, much like in Rust's `Vec`, stores its contents in a buffer allocated on
30 /// the heap. In this example the vector object itself is stored and initialized as a static
31 /// variable – a compile time construct. The heap, on the other hand, is a runtime construct. And
32 /// yet the code works exactly as you'd expect – the vector contains numbers 1, 2 and 3 stored in
33 /// a buffer on heap. So, _what_ makes it work out, exactly?
34 ///
35 /// Various executable and shared library formats define conventions and machinery to execute
36 /// arbitrary code when a program or a shared library is loaded. On systems using the PE format
37 /// (e.g. Windows) this is available via the optional `DllMain` initializer. Various systems
38 /// utilizing the ELF format take a sightly different approach of maintaining an array of function
39 /// pointers in the `.init_array` section. A very similar mechanism exists on systems that utilize
40 /// the Mach-O format.
41 ///
42 /// For the C++ program above, the object stored in the `UNSHUU` global variable is constructed
43 /// by code run as part of such an initializer routine. This initializer is run before the entry
44 /// point (the `main` function) is executed, allowing for this magical behaviour to be possible.
45 /// Were the C++ code built as a shared library instead, the initialization routines would run as
46 /// the resulting shared library is loaded. In case of `libloading` – during the call to
47 /// `Library::new` and other methods affected by this change.
48 ///
49 /// These initialization (and very closely related termination) routines can be utilized outside of
50 /// C++ too. Anybody can build a shared library in variety of different programming languages and
51 /// set up the initializers to execute arbitrary code. Potentially code that does all sorts of
52 /// wildly unsound stuff.
53 ///
54 /// The routines are executed by components that are an integral part of the operating system.
55 /// Changing or controlling the operation of these components is infeasible. With that in
56 /// mind, the initializer and termination routines are something anybody loading a library must
57 /// carefully evaluate the libraries loaded for soundness.
58 ///
59 /// In practice, a vast majority of the libraries can be considered a good citizen and their
60 /// initialization and termination routines, if they have any at all, can be trusted to be sound.
61 ///
62 /// Also see: [issue #86].
63 ///
64 /// ### Better & more consistent default behaviour on UNIX systems
65 ///
66 /// On UNIX systems the [`Library::new`], [`os::unix::Library::new`] and
67 /// [`os::unix::Library::this`] methods have been changed to use
68 /// <code>[RTLD_LAZY] | [RTLD_LOCAL]</code> as the default set of loader options (previously:
69 /// [`RTLD_NOW`]). This has a couple benefits. Namely:
70 ///
71 /// * Lazy binding is generally quicker to execute when only a subset of symbols from a library are
72 ///   used and is typically the default when neither `RTLD_LAZY` nor `RTLD_NOW` are specified when
73 ///   calling the underlying `dlopen` API;
74 /// * On most UNIX systems (macOS being a notable exception) `RTLD_LOCAL` is the default when
75 ///   neither `RTLD_LOCAL` nor [`RTLD_GLOBAL`] are specified. The explicit setting of the
76 ///   `RTLD_LOCAL` flag makes this behaviour consistent across platforms.
77 ///
78 /// ### Dropped support for Windows XP/Vista
79 ///
80 /// The (broken) support for Windows XP and Windows Vista environments was removed. This was
81 /// prompted primarily by a similar policy change in the [Rust
82 /// project](https://github.com/rust-lang/compiler-team/issues/378) but also as an acknowledgement
83 /// to the fact that `libloading` never worked in these environments anyway.
84 ///
85 /// ### More accurate error variant names
86 ///
87 /// Finally, the `Error::LoadLibraryW` renamed to [`Error::LoadLibraryExW`] to more accurately
88 /// represent the underlying API that's failing. No functional changes as part of this rename
89 /// intended.
90 ///
91 /// [issue #86]: https://github.com/nagisa/rust_libloading/issues/86
92 /// [`Library::new`]: crate::Library::new
93 /// [`Error::LoadLibraryExW`]: crate::Error::LoadLibraryExW
94 /// [`os::unix::Library::this`]: crate::os::unix::Library::this
95 /// [`os::unix::Library::new`]: crate::os::unix::Library::new
96 /// [`os::unix::Library::open`]: crate::os::unix::Library::new
97 /// [`os::windows::Library::new`]: crate::os::windows::Library::new
98 /// [`os::windows::Library::load_with_flags`]: crate::os::windows::Library::load_with_flags
99 /// [`RTLD_NOW`]: crate::os::unix::RTLD_NOW
100 /// [RTLD_LAZY]: crate::os::unix::RTLD_LAZY
101 /// [RTLD_LOCAL]: crate::os::unix::RTLD_LOCAL
102 /// [`RTLD_GLOBAL`]: crate::os::unix::RTLD_GLOBAL
103 pub mod r0_7_0 {}
104 
105 /// Release 0.6.7 (2021-01-14)
106 ///
107 /// * Added a [`os::windows::Library::open_already_loaded`] to obtain a handle to a library that
108 /// must already be loaded. There is no portable equivalent for all UNIX targets. Users who do not
109 /// care about portability across UNIX platforms may use [`os::unix::Library::open`] with
110 /// `libc::RTLD_NOLOAD`;
111 ///
112 /// [`os::windows::Library::open_already_loaded`]: crate::os::windows::Library::open_already_loaded
113 /// [`os::unix::Library::open`]: crate::os::unix::Library::open
114 pub mod r0_6_7 {}
115 
116 /// Release 0.6.6 (2020-12-03)
117 ///
118 /// * Fix a double-release of resources when [`Library::close`] or [`os::windows::Library::close`]
119 ///   is used on Windows.
120 ///
121 /// [`Library::close`]: crate::Library::close
122 /// [`os::windows::Library::close`]: crate::os::windows::Library::close
123 pub mod r0_6_6 {}
124 
125 /// Release 0.6.5 (2020-10-23)
126 ///
127 /// * Upgrade cfg-if 0.1 to 1.0
128 pub mod r0_6_5 {}
129 
130 /// Release 0.6.4 (2020-10-10)
131 ///
132 /// * Remove use of `build.rs` making it easier to build `libloading` without cargo. It also
133 ///   almost halves the build time of this crate.
134 pub mod r0_6_4 {}
135 
136 /// Release 0.6.3 (2020-08-22)
137 ///
138 /// * Improve documentation, allowing to view all of the os-specific functionality from
139 /// documentation generated for any target;
140 /// * Add [`os::windows::Library::this`];
141 /// * Added constants to use with OS-specific `Library::open`;
142 /// * Add [`library_filename`].
143 ///
144 /// [`os::windows::Library::this`]: crate::os::windows::Library::this
145 /// [`library_filename`]: crate::library_filename
146 pub mod r0_6_3 {}
147 
148 /// Release 0.6.2 (2020-05-06)
149 ///
150 /// * Fixed building of this library on Illumos.
151 pub mod r0_6_2 {}
152 
153 /// Release 0.6.1 (2020-04-15)
154 ///
155 /// * Introduced a new method [`os::windows::Library::load_with_flags`];
156 /// * Added support for the Illumos triple.
157 ///
158 /// [`os::windows::Library::load_with_flags`]: crate::os::windows::Library::load_with_flags
159 pub mod r0_6_1 {}
160 
161 /// Release 0.6.0 (2020-04-05)
162 ///
163 /// * Introduced a new method [`os::unix::Library::get_singlethreaded`];
164 /// * Added (untested) support for building when targetting Redox and Fuchsia;
165 /// * The APIs exposed by this library no longer panic and instead return an `Err` when it used
166 ///   to panic.
167 ///
168 /// ## Breaking changes
169 ///
170 /// * Minimum required (stable) version of Rust to build this library is now 1.40.0;
171 /// * This crate now implements a custom [`Error`] type and all APIs now return this type rather
172 ///   than returning the `std::io::Error`;
173 /// * `libloading::Result` has been removed;
174 /// * Removed the dependency on the C compiler to build this library on UNIX-like platforms.
175 ///   `libloading` used to utilize a snippet written in C to work-around the unlikely possibility
176 ///   of the target having a thread-unsafe implementation of the `dlerror` function. The effect of
177 ///   the work-around was very opportunistic: it would not work if the function was called by
178 ///   forgoing `libloading`.
179 ///
180 ///   Starting with 0.6.0, [`Library::get`] on platforms where `dlerror` is not MT-safe (such as
181 ///   FreeBSD, DragonflyBSD or NetBSD) will unconditionally return an error when the underlying
182 ///   `dlsym` returns a null pointer. For the use-cases where loading null pointers is necessary
183 ///   consider using [`os::unix::Library::get_singlethreaded`] instead.
184 ///
185 /// [`Library::get`]: crate::Library::get
186 /// [`os::unix::Library::get_singlethreaded`]: crate::os::unix::Library::get_singlethreaded
187 /// [`Error`]: crate::Error
188 pub mod r0_6_0 {}
189 
190 
191 /// Release 0.5.2 (2019-07-07)
192 ///
193 /// * Added API to convert OS-specific `Library` and `Symbol` conversion to underlying resources.
194 pub mod r0_5_2 {}
195 
196 /// Release 0.5.1 (2019-06-01)
197 ///
198 /// * Build on Haiku targets.
199 pub mod r0_5_1 {}
200 
201 /// Release 0.5.0 (2018-01-11)
202 ///
203 /// * Update to `winapi = ^0.3`;
204 ///
205 /// ## Breaking changes
206 ///
207 /// * libloading now requires a C compiler to build on UNIX;
208 ///   * This is a temporary measure until the [`linkage`] attribute is stabilised;
209 ///   * Necessary to resolve [#32].
210 ///
211 /// [`linkage`]: https://github.com/rust-lang/rust/issues/29603
212 /// [#32]: https://github.com/nagisa/rust_libloading/issues/32
213 pub mod r0_5_0 {}
214 
215 /// Release 0.4.3 (2017-12-07)
216 ///
217 /// * Bump lazy-static dependency to `^1.0`;
218 /// * `cargo test --release` now works when testing libloading.
219 pub mod r0_4_3 {}
220 
221 
222 /// Release 0.4.2 (2017-09-24)
223 ///
224 /// * Improved error and race-condition handling on Windows;
225 /// * Improved documentation about thread-safety of Library;
226 /// * Added `Symbol::<Option<T>::lift_option() -> Option<Symbol<T>>` convenience method.
227 pub mod r0_4_2 {}
228 
229 
230 /// Release 0.4.1 (2017-08-29)
231 ///
232 /// * Solaris support
233 pub mod r0_4_1 {}
234 
235 /// Release 0.4.0 (2017-05-01)
236 ///
237 /// * Remove build-time dependency on target_build_utils (and by extension serde/phf);
238 /// * Require at least version 1.14.0 of rustc to build;
239 ///   * Actually, it is cargo which has to be more recent here. The one shipped with rustc 1.14.0
240 ///     is what’s being required from now on.
241 pub mod r0_4_0 {}
242 
243 /// Release 0.3.4 (2017-03-25)
244 ///
245 /// * Remove rogue println!
246 pub mod r0_3_4 {}
247 
248 /// Release 0.3.3 (2017-03-25)
249 ///
250 /// * Panics when `Library::get` is called for incompatibly sized type such as named function
251 ///   types (which are zero-sized).
252 pub mod r0_3_3 {}
253 
254 /// Release 0.3.2 (2017-02-10)
255 ///
256 /// * Minimum version required is now rustc 1.12.0;
257 /// * Updated dependency versions (most notably target_build_utils to 0.3.0)
258 pub mod r0_3_2 {}
259 
260 /// Release 0.3.1 (2016-10-01)
261 ///
262 /// * `Symbol<T>` and `os::*::Symbol<T>` now implement `Send` where `T: Send`;
263 /// * `Symbol<T>` and `os::*::Symbol<T>` now implement `Sync` where `T: Sync`;
264 /// * `Library` and `os::*::Library` now implement `Sync` (they were `Send` in 0.3.0 already).
265 pub mod r0_3_1 {}
266 
267 /// Release 0.3.0 (2016-07-27)
268 ///
269 /// * Greatly improved documentation, especially around platform-specific behaviours;
270 /// * Improved test suite by building our own library to test against;
271 /// * All `Library`-ies now implement `Send`.
272 /// * Added `impl From<os::platform::Library> for Library` and `impl From<Library> for
273 /// os::platform::Library` allowing wrapping and extracting the platform-specific library handle;
274 /// * Added methods to wrap (`Symbol::from_raw`) and unwrap (`Symbol::into_raw`) the safe `Symbol`
275 /// wrapper into unsafe `os::platform::Symbol`.
276 ///
277 /// The last two additions focus on not restricting potential usecases of this library, allowing
278 /// users of the library to circumvent safety checks if need be.
279 ///
280 /// ## Breaking Changes
281 ///
282 /// `Library::new` defaults to `RTLD_NOW` instead of `RTLD_LAZY` on UNIX for more consistent
283 /// cross-platform behaviour. If a library loaded with `Library::new` had any linking errors, but
284 /// unresolved references weren’t forced to be resolved, the library would’ve “just worked”,
285 /// whereas now the call to `Library::new` will return an error signifying presence of such error.
286 ///
287 /// ## os::platform
288 /// * Added `os::unix::Library::open` which allows specifying arbitrary flags (e.g. `RTLD_LAZY`);
289 /// * Added `os::windows::Library::get_ordinal` which allows finding a function or variable by its
290 /// ordinal number;
291 pub mod r0_3_0 {}
292