Skip to content

Commit 94ec48c

Browse files
committed
Specify the external library we link to on Windows
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.
1 parent 2c9b18a commit 94ec48c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "stacker"
3-
version = "0.1.6"
3+
version = "0.1.7"
44
authors = ["Alex Crichton <[email protected]>", "Simonas Kazlauskas <[email protected]>"]
55
build = "build.rs"
66
license = "MIT/Apache-2.0"
77
readme = "README.md"
88
repository = "https://github.com/rust-lang/stacker"
99
homepage = "https://github.com/rust-lang/stacker"
10-
documentation = "https://docs.rs/stacker/0.1.6"
10+
documentation = "https://docs.rs/stacker/0.1.7"
1111
description = """
1212
A stack growth library useful when implementing deeply recursive algorithms that
1313
may accidentally blow the stack.
@@ -21,7 +21,7 @@ test = false
2121
[dependencies]
2222
cfg-if = "0.1.6"
2323
libc = "0.2.45"
24-
psm = "0.1.5"
24+
psm = "0.1.7"
2525

2626
[target.'cfg(windows)'.dependencies.winapi]
2727
version = "0.3.6"

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ cfg_if! {
219219
use winapi::um::processthreadsapi::*;
220220
use winapi::um::winbase::*;
221221

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

0 commit comments

Comments
 (0)