Created
December 15, 2014 23:11
-
-
Save mpfund/419388c82b39115658c2 to your computer and use it in GitHub Desktop.
empty dynamorio client in rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![crate_type = "dylib"] | |
#![feature(link_args)] | |
extern crate libc; | |
pub type ClientIdT = u32; | |
#[no_mangle] | |
pub static _USES_DR_VERSION_:i32 = 500; | |
#[link(name="dynamorio")] | |
extern { | |
//bool dr_set_client_name(const char *name, const char *report_URL); | |
fn dr_set_client_name(name:*const u8,report_URL:*const u8) -> bool; | |
} | |
pub fn set_client_name(name:&str,url:&str) { | |
unsafe{ | |
dr_set_client_name(name.as_ptr(), url.as_ptr()); | |
} | |
} | |
extern "C" fn event_exit(){ | |
println!("event_exit called"); | |
} | |
#[no_mangle] | |
pub extern fn dr_init(id:ClientIdT){ | |
println!("id: {}",id); | |
set_client_name("dummy1",""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment