Skip to content

Instantly share code, notes, and snippets.

@SiegeLord
Created April 11, 2013 20:13
Show Gist options
  • Select an option

  • Save SiegeLord/5366786 to your computer and use it in GitHub Desktop.

Select an option

Save SiegeLord/5366786 to your computer and use it in GitHub Desktop.
atexit
use core::libc::c_int;
pub extern "C"
{
fn c_func(atexit_ptr : extern "C" fn(cb : extern "C" fn()) -> c_int) -> bool;
fn atexit(cb : extern "C" fn()) -> c_int;
}
fn main()
{
unsafe
{
c_func(atexit);
}
}
bin.rs:13:15: 13:21 error: mismatched types: expected `extern "C" fn(extern "C" fn()) -> i32` but found `extern "Rust" unsafe fn(extern "C" fn()) -> i32` (expected impure fn but found unsafe fn)
bin.rs:13 c_func(atexit);
^~~~~~
error: aborting due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment