#[no_mangle]
pub extern "stdcall" fn rustforin() {
let mut sum = String::new();
for i in 1..=99 {
for j in 1..=99 {
for k in 1..99 {
if i == j || i == k || j == k {
} else {
sum += &format!("{:02} {:02} {:02}\r\n", i, j, k);
}
}
}
}
let mut file = std::fs::File::create("三位数.txt").expect("创建失败");
file.write_all(sum.as_bytes()).expect("创建失败");
}
use std::io::Write;
#[no_mangle]
pub extern "stdcall" fn rustforin() {
let mut sum = String::new();
let mut a;
let mut b;
let mut c;
for i in 1..=99 {
for j in 1..=99 {
for k in 1..99 {
if i == j || i == k || j == k {
} else {
if i < 10 {
a = String::from("0") + &i.to_string();
} else {
a = i.to_string();
}
if j < 10 {
b = String::from("0") + &j.to_string();
} else {
b = j.to_string();
}
if k < 10 {
c = String::from("0") + &k.to_string();
} else {
c = k.to_string();
}
sum = sum + &a + &String::from(" ") + &b + &String::from(" ") + &c + "\r\n";
}
}
}
}
let mut file = std::fs::File::create("三位数.txt").expect("创建失败");
file.write_all(sum.as_bytes()).expect("创建失败");
}
我电脑找到了对应的link.exe ,
但是提示错误,
Compiling testdll v0.1.0 (E:\b各种语言代码\rustCode\testdll)
error[E0463]: can't find crate for `std`
|
= note: the `i686-pc-windows-msvc` target may not be installed
= help: consider downloading the target with `rustup target add i686-pc-windows-msvc`
error: requires `sized` lang_item
For more information about this error, try `rustc --explain E0463`.