Skip to content

Instantly share code, notes, and snippets.

Created December 13, 2017 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/c5c26a52a9b6d62a0806302e45336311 to your computer and use it in GitHub Desktop.
Save anonymous/c5c26a52a9b6d62a0806302e45336311 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int hello(char args[])
{
printf("%s\n", args);
return 0;
}
extern crate libc;
#[link(name="libcore")]
extern {
fn hello(args: &str) -> i32;
}
fn main(){
let input = "hello, cffi!";
unsafe{
hello(&input);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment