Skip to content

Commit

Permalink
Specify the external library we link to on Windows
Browse files Browse the repository at this point in the history
As of recently it is no longer sufficient to just build the `libX.a`
with the cc crate in build.rs. Due to
rust-lang/rust#65610 it is also necessary to
specify the fact of linkage in the source for it to work in all
scenarios. The most frustrating part is that it only fails when shared
libraries are in the equation, which is a comparatively rare use-case in
Rust-land.
  • Loading branch information
nagisa committed Mar 29, 2020
1 parent 2c9b18a commit 94ec48c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "stacker"
version = "0.1.6"
version = "0.1.7"
authors = ["Alex Crichton <alex@alexcrichton.com>", "Simonas Kazlauskas <git@kazlauskas.me>"]
build = "build.rs"
license = "MIT/Apache-2.0"
readme = "README.md"
repository = "https://github.com/rust-lang/stacker"
homepage = "https://github.com/rust-lang/stacker"
documentation = "https://docs.rs/stacker/0.1.6"
documentation = "https://docs.rs/stacker/0.1.7"
description = """
A stack growth library useful when implementing deeply recursive algorithms that
may accidentally blow the stack.
Expand All @@ -21,7 +21,7 @@ test = false
[dependencies]
cfg-if = "0.1.6"
libc = "0.2.45"
psm = "0.1.5"
psm = "0.1.7"

[target.'cfg(windows)'.dependencies.winapi]
version = "0.3.6"
Expand Down
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ cfg_if! {
use winapi::um::processthreadsapi::*;
use winapi::um::winbase::*;

// Make sure the libstacker.a (implemented in C) is linked.
// See https://github.com/rust-lang/rust/issues/65610
#[link(name="stacker")]
extern {
fn __stacker_get_current_fiber() -> PVOID;
}
Expand Down

0 comments on commit 94ec48c

Please sign in to comment.