kind=dylib
: The library is passed to each linker invocation.
If the library is actually a static library with global state, this results in global state duplication.
If combined with #[linked_from]
this implies dllimport
.
Search path is wherever the linker searches, this includes the Windows SDK paths that rustc finds for us.
kind=static
: The library is bundled into the .rlib.
If the library is a static library with global state, Rust ensures there is only one of a given .rlib linked to a .exe, so there is no global state duplication.
If combined with #[linked_from]
, dllimport
is not applied.
Search path is only paths which have been explicitly passed to rustc, so this does not include the Windows SDK.
If the library is a static library, but I am unable to tell rustc exactly where the library is (for example libraries in the Windows SDK), then rustc cannot find it and things fail. In addition the bundling behavior isn't needed, it just needs to only be passed to a single linker invocation to prevent state duplication. Therefore adding a third kind would be very useful:
kind=something
: The library is passed to the first immediate linker invocation, and then re-exported as needed.
If the library is a static library with global state, since it is only passed to a single linker invocation, there is only one instance.
If combined with #[linked_from]
, dllimport
is not applied.
Search path is wherever the linker searches, this includes the Windows SDK paths that rustc finds for us.