`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
Otherwise it leads to a double-free, once in `close` and another time in
`drop`. Curiously this was only a bug on Windows, and Unix code was
fine. Not sure how this happened.
This should make building of this crate significantly faster.
At the same time we also correctly annotate the linkage on the `extern`
block, the way it ought to be.
Sadly there's a regression in tests – the helper scripts no longer
specify the target for which tests are being built. This shall be
addressed in a subsequent commit.
The newly added method does resolve the library name passed to it by
adhering to platform-specific naming schemes using Rust provided
constants.
Closes#62
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.
With these improvements browsing the documentation for os-specific
functionality should be possible from any system. In particular UNIX
documentation now has information on Windows and the Windows
documentation has information on UNIX-specific stuff.