`docsrs` is a commonly used `cfg` identifier. `libloading`'s
implementation is written in such a way that it cannot compile with this
cfg set, but is still able to produce documentation. This is done so
that the documentation is naturally covering all platform-specific
details in a single page, without users having to e.g. switch between
Windows® and Linux when reading the documentation on `docs.rs`.
The downstream crates may accidentally set this `cfg` for `rustc`
invocations as well, which can then cause them to fail to build, for no
good reason!
Using a cfg specific to a crate (e.g. `libloading_docs`)
more accurately reflects the purpose of this cfg and avoids these
problems altogether.
Fixes#101
On MSVC Windows loading a TLS symbol will give an address to the
initializer (which when overwritten simply changes the default value new
threads gain for the variable).
On macOS thread locals are misimplemented entirely.
On Linux things "just work", but unknown to what extent, really.
Since the behaviour of using thread local variables as if they were
plain global variables is mostly undefined, lets just not make any
claims of this working.
This allows us to:
a) remove the panics in this library and give the control over what to
do to the user;
b) expose the error conditions to the user better, even if just slightly;
c) implement the modern error handling currently implemented in many of
the modern Rust libraries.