Skip to content

Instantly share code, notes, and snippets.

@jonatino
Created September 15, 2023 23:25
Show Gist options
  • Save jonatino/6089cc41617a7b3b78d97e79fc8d18f5 to your computer and use it in GitHub Desktop.
Save jonatino/6089cc41617a7b3b78d97e79fc8d18f5 to your computer and use it in GitHub Desktop.
// extern crate bindgen;
// use std::env;
// use std::path::PathBuf;
fn main() {
// Tell cargo to tell rustc to link the Gdiplus shared library.
println!("cargo:rustc-link-lib=Gdiplus");
// // Tell cargo to invalidate the built crate whenever the wrapper changes
// println!("cargo:rerun-if-changed=wrapper.hpp");
// // The bindgen::Builder is the main entry point
// // to bindgen, and lets you build up options for
// // the resulting bindings.
// let bindings = bindgen::Builder::default()
// // The input header we would like to generate
// // bindings for.
// .header("wrapper.hpp")
// .blocklist_type("LPMONITORINFOEXA?W?")
// .blocklist_type("LPTOP_LEVEL_EXCEPTION_FILTER")
// .blocklist_type("MONITORINFOEXA?W?")
// .blocklist_type("PEXCEPTION_FILTER")
// .blocklist_type("PEXCEPTION_ROUTINE")
// .blocklist_type("PSLIST_HEADER")
// .blocklist_type("PTOP_LEVEL_EXCEPTION_FILTER")
// .blocklist_type("PVECTORED_EXCEPTION_HANDLER")
// .blocklist_type("_?L?P?CONTEXT")
// .blocklist_type("_?L?P?EXCEPTION_POINTERS")
// .blocklist_type("_?P?DISPATCHER_CONTEXT")
// .blocklist_type("_?P?EXCEPTION_REGISTRATION_RECORD")
// .blocklist_type("_?P?IMAGE_TLS_DIRECTORY.*")
// .blocklist_type("_?P?NT_TIB")
// .blocklist_type("tagMONITORINFOEXA")
// .blocklist_type("tagMONITORINFOEXW")
// .blocklist_function("AddVectoredContinueHandler")
// .blocklist_function("AddVectoredExceptionHandler")
// .blocklist_function("CopyContext")
// .blocklist_function("GetThreadContext")
// .blocklist_function("GetXStateFeaturesMask")
// .blocklist_function("InitializeContext")
// .blocklist_function("InitializeContext2")
// .blocklist_function("InitializeSListHead")
// .blocklist_function("InterlockedFlushSList")
// .blocklist_function("InterlockedPopEntrySList")
// .blocklist_function("InterlockedPushEntrySList")
// .blocklist_function("InterlockedPushListSListEx")
// .blocklist_function("LocateXStateFeature")
// .blocklist_function("QueryDepthSList")
// .blocklist_function("RaiseFailFastException")
// .blocklist_function("RtlCaptureContext")
// .blocklist_function("RtlCaptureContext2")
// .blocklist_function("RtlFirstEntrySList")
// .blocklist_function("RtlInitializeSListHead")
// .blocklist_function("RtlInterlockedFlushSList")
// .blocklist_function("RtlInterlockedPopEntrySList")
// .blocklist_function("RtlInterlockedPushEntrySList")
// .blocklist_function("RtlInterlockedPushListSListEx")
// .blocklist_function("RtlQueryDepthSList")
// .blocklist_function("RtlRestoreContext")
// .blocklist_function("RtlUnwindEx")
// .blocklist_function("RtlVirtualUnwind")
// .blocklist_function("SetThreadContext")
// .blocklist_function("SetUnhandledExceptionFilter")
// .blocklist_function("SetXStateFeaturesMask")
// .blocklist_function("UnhandledExceptionFilter")
// .blocklist_function("__C_specific_handler")
// .allowlist_function(".*Gdiplus.*")
// // Tell cargo to invalidate the built crate whenever any of the
// // included header files changed.
// .parse_callbacks(Box::new(bindgen::CargoCallbacks))
// // Finish the builder and generate the bindings.
// .generate()
// // Unwrap the Result and panic on failure.
// .expect("Unable to generate bindings");
// // Write the bindings to the $OUT_DIR/bindings.rs file.
// let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
// bindings
// .write_to_file(out_path.join("bindings.rs"))
// .expect("Couldn't write bindings!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment