-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c396e36
commit 3b4de45
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// This page is intentionally left blank |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
LIBRARY dll | ||
EXPORTS | ||
hello | ||
number |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
//@ only-msvc | ||
// Reason: this is testing the MSVC linker | ||
|
||
// This is a regression test for #129020 | ||
// It ensures we can link a rust staticlib into DLL using the MSVC linker | ||
|
||
use run_make_support::run::cmd; | ||
use run_make_support::rustc; | ||
|
||
fn main() { | ||
// BUild the staticlib | ||
rustc().crate_type("staticlib").input("static.rs").output("static.lib").run(); | ||
// Create an empty obj file (using the C compiler) | ||
// Then use it to link in the staticlib using `/WHOLEARCHIVE` and produce a DLL. | ||
// We call link.exe directly because this test is only for MSVC and not their LLVM equivalents | ||
cmd("cl.exe").args(&["c.c", "-nologo", "-c", "-MT"]).run(); | ||
cmd("link.exe") | ||
.args(&["c", "/WHOLEARCHIVE:./static.lib", "/dll", "/def:dll.def", "/out:dll.dll"]) | ||
// Import libs | ||
.args(&["libcmt.lib", "kernel32.lib", "ws2_32.lib", "ntdll.lib", "userenv.lib"]) | ||
.run(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#[no_mangle] | ||
pub extern "C" fn hello() { | ||
println!("Hello world!"); | ||
} | ||
|
||
#[no_mangle] | ||
pub extern "C" fn number() -> u32 { | ||
42 | ||
} |