Cargo bloat on windows

Hello;
I want to reduce the size of my compiled executable. But without cargo-bloat on windows it is a nightmare.
The problem is that my program uses WinAPI so it only builds on windows.
If you have a solution for me.
Thank's in advance;
ccgauche.

Depending on how deeply integrated WinAPI is to your application, you can use #[cfg(target_os = "windows")] to only compile your WinAPI based functions on windows, and write functions that have the same name and signature but annotate them with #[cfg(not(target_os = "windows"))] so that your program can still compile on other OSses.

While it doesn't measure binary size directly, cargo llvm-lines might still be useful for finding likely areas to focus on.

My program only uses WinAPI so without it there no code.

1 Like

Here the output, have you any idea to reduce the exe size with that. I see that image::JPEGEncoder takes a lot of space. Is there an alternative?