Skip to content
/ rust-apisets Public template

Link Windows Rust binaries to customizable APISets

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

talagrand/rust-apisets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust projects on Windows link to kernel32.dll, advapi32.dll, etc, through the standard library or other third-party libraries like windows-rs.

There is sometimes the specialized need to customize linking, for example by binding directly to APISet - contract names, or to provide substitute DLLs depending on the target OS combinations. An example where contract names might be useful would be to avoid certain DLLs that are part of the dependency graph of the historic, well-known names. This might be useful if you wish to run your code under the win32k process mitigation, which fails user32's DLL load. user32.dll is a dependency of ole32.dll, which means COM is not available unless you link the the APISet contracts, which avoid this dependency.

Which libraries are sent to the linker is not currently a customizable extension point in Cargo. This repository demonstrates a workaround. The linker to use is customizable, so this project creates a batch script (apisetlinker.cmd) which intercepts invocations of the MSVC linker and removes problematic library references and allows you to replace them with your own. apisetlinker.cmd is configured in .config/cargo.toml.

About

Link Windows Rust binaries to customizable APISets

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks