Skip to content

Instantly share code, notes, and snippets.

@bollu
Forked from mcpherrinm/pytest.rs
Created June 13, 2014 20:46
Show Gist options
  • Save bollu/0ae4fcb60d88862bb3a6 to your computer and use it in GitHub Desktop.
Save bollu/0ae4fcb60d88862bb3a6 to your computer and use it in GitHub Desktop.
#[link(name="python2.7")]
extern {
fn Py_SetProgramName(name: *u8);
fn Py_Initialize();
fn PyRun_SimpleString(command: *u8);
fn Py_Finalize();
}
fn main() {
let args = std::os::args();
let filename = args.get(0);
unsafe {
Py_SetProgramName(&filename[0]);
Py_Initialize();
PyRun_SimpleString(&"print \"wombats\""[0]);
Py_Finalize();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment