embed-resource 1.0.1

A Cargo library to handle compilation and inclusion of Windows resources in the most resilient fashion imaginable
Documentation

rust-embed-resource TravisCI build status AppVeyorCI build status Licence Crates.io version

A Cargo build script library to handle compilation and inclusion of Windows resources in the most resilient fashion imaginable

Documentation

Quickstart

In your build script, assuming the crate's name is "checksums" and the resource file is called checksums.rc:

extern crate embed_resource;

fn main() {
    // Compile file checksums.rc to be linkable as checksums-manifest in $OUT_DIR
    embed_resource::compile("checksums.rc", None, None);
}

Then, in main.rs:

#[cfg(target_os="windows")]
#[link(name="checksums-manifest", kind="static")]
extern "C" {}

If you want to link as something else (like chksum-rc):

embed_resource::compile("checksums.rc", Some("chksum-rc"), None);
#[cfg(target_os="windows")]
#[link(name="chksum-rc", kind="static")]
extern "C" {}

Credit

In chronological order:

@liigo -- persistency in pestering me and investigating problems where I have failed

@mzji -- MSVC lab rat

@TheCatPlusPlus -- knowledge and providing first iteration of manifest-embedding code

@azyobuzin -- providing code for finding places where RC.EXE could hide