Crates.io | oldwin |
lib.rs | oldwin |
version | 0.1.3 |
created_at | 2024-09-12 02:40:18.916115+00 |
updated_at | 2024-12-25 11:47:46.815441+00 |
description | A Rust library for easy to compatible with older Windows |
homepage | |
repository | https://github.com/honsunrise/oldwin |
max_upload_size | |
id | 1372441 |
size | 11,220 |
OldWin OldWin makes compatibility with Old Windows easier! The crate relies heavily on YY-Thunks and VC-LTL5 to solve the problem of missing APIs on older systems and API-SETs in the import table.
build-dependencies
and modify build.rs
.Include OldWin in your Cargo.toml
file:
vc-ltl5 is dependent on yy-thunks, so if you use vc-ltl5 yy-thunks will be automatically added.
# use yy-thunks and vc-ltl5 on Windows 7
[target.'cfg(target_family = "windows")'.dependencies]
oldwin-targets = { version = "0.1.1", default-features = false, features = [
"win7",
"yy-thunks",
"vc-ltl5",
] }
[target.'cfg(target_family = "windows")'.build-dependencies]
# use yy-thunks and vc-ltl5 on Windows 7
oldwin = { version = "0.1.1", default-features = false, features = [
"win7",
"yy-thunks",
"vc-ltl5",
] }
build.rs
// build.rs
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// ... your code ...
#[cfg(target_family = "windows")] {
oldwin::overwrite_subsystem(oldwin::Subsystem::Console);
oldwin::inject();
}
// ... your code ...
}
Modify your project cargo configuration to use the {x86, x86_64}-win7-windows-msvc toolchain.
rustup component add rust-src
rustup target add i686-win7-windows-msvc
rustup target add x86_64-win7-windows-msvc
[unstable]
build-std = ["core", "alloc", "std", "proc_macro", "test"]
If you want to statically link the C runtime, you can modify your cargo configuration to add -C target-feature=+crt-static
to the rustflags.
# config.toml
[target.x86_64-win7-windows-msvc]
rustflags = [
"-C", "target-feature=+crt-static",
]
[target.i686-win7-windows-msvc]
rustflags = [
"-C", "target-feature=+crt-static",
]
Build your project using the {i686, x86_64}-win7-windows-msvc toolchain.
Remember to use nightly toolchain.
cargo build --target i686-win7-windows-msvc -Zbuild-std
cargo build --target x86_64-win7-windows-msvc -Zbuild-std
Contributions of all kinds are welcome, including:
OldWin is released under the MIT License.