Skip to content

Commit 6bc4465

Browse files
committed
Add test for MSVC WHOLEARCHIVE
1 parent c396e36 commit 6bc4465

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

tests/run-make/msvc-wholearchive/c.c

Whitespace-only changes.
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
LIBRARY dll
2+
EXPORTS
3+
hello
4+
number
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//@ only-msvc
2+
// Reason: this is testing the MSVC linker
3+
4+
use run_make_support::run::cmd;
5+
use run_make_support::rustc;
6+
7+
fn main() {
8+
rustc().crate_type("staticlib").input("static.rs").output("static.lib").run();
9+
// We call link.exe directly because this test is only for MSVC and not their LLVM equivalents
10+
cmd("cl.exe").args(&["c.c", "-nologo", "-c", "-MT"]).run();
11+
cmd("link.exe")
12+
.args(&["c", "/WHOLEARCHIVE:./static.lib", "/dll", "/def:dll.def", "/out:dll.dll"])
13+
// Import libs
14+
.args(&["libcmt.lib", "kernel32.lib", "ws2_32.lib", "ntdll.lib", "userenv.lib"])
15+
.run();
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#[no_mangle]
2+
pub extern "C" fn hello() {
3+
println!("Hello world!");
4+
}
5+
6+
#[no_mangle]
7+
pub extern "C" fn number() -> u32 {
8+
42
9+
}

0 commit comments

Comments
 (0)