Files
rust/tests/ui/linkage-attr/msvc-static-data-import.rs

19 lines
690 B
Rust
Raw Normal View History

2025-06-29 17:43:51 +05:00
//! Test that static data from external crates can be imported on MSVC targets.
//!
//! On Windows MSVC targets, static data from external rlibs must be imported
//! through `__imp_<symbol>` stubs to ensure proper linking. Without this,
//! the linker would fail with "unresolved external symbol" errors when trying
//! to reference static data from another crate.
//!
//! Regression test for <https://github.com/rust-lang/rust/issues/26591>.
//! Fixed in <https://github.com/rust-lang/rust/pull/28646>.
//@ run-pass
2025-06-29 17:43:51 +05:00
//@ aux-build:msvc-static-data-import-lib.rs
2015-09-25 18:48:54 -07:00
2025-06-29 17:43:51 +05:00
extern crate msvc_static_data_import_lib;
fn main() {
2025-06-29 17:43:51 +05:00
println!("The answer is {}!", msvc_static_data_import_lib::FOO);
}