Last active
May 10, 2023 10:35
-
-
Save mcpherrinm/4005548617f8d6300c60 to your computer and use it in GitHub Desktop.
This file contains 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
#[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.as_ptr()); | |
Py_Initialize(); | |
PyRun_SimpleString("print \"wombats\"".as_ptr()); | |
Py_Finalize(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment