Rust & FLTK
A (mostly) fictional project
How do you convert product IDs to hyperlinks?
In Microsoft Excel, try
=CONCAT("https://example.com/products?id=", A1)
That’s programming! I could never program!
Maybe we could vibe code an app.
nix flake init# flake.nix
{
description = "Product Basket";
inputs = {
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst";
}
outputs = inputs: {
packages =
{
# Minimalist GNU for Windows (MinGW) configuration
# to build
};
devShells =
{
# local Linux build, for development
};
}
}
cargo new basketbasket/
Cargo.toml
src/
main.rs
A build.rs file runs at compile time.
fn main() {
// Embed the application icon into the Windows executable.
if std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows") {
winresource::WindowsResource::new()
.set_icon("assets/basket.ico")
.compile()
.expect("failed to embed Windows icon");
}
}
MinGW provides a winres utility to embed icons. Why use
Rust build time?
You do need to get MinGW from somewhere. Nix was a convenient spot.
But does Cargo include something to target windows anyways? (Yes and no.)
Operating systems expect a certain format for executables.
Linux: Executable and Linking Format (ELF)
Microsoft Windows: Portable Executable (PE)
Application Binary Interface (ABI) actually refers to… the whole set of operating system interfaces? (It seems to in Linux, at least.)