-
-
Save bollu/1bd9ac58f886c5efe865 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
mm@cereal:~/dytest$ rustc -C prefer-dynamic --crate-type=dylib fooz.rs | |
mm@cereal:~/dytest$ cat fooz.rs | |
#[no_mangle] | |
pub extern "C" fn foo(x: int) { | |
println!("Cowabunga, {}", x); | |
} | |
mm@cereal:~/dytest$ cat test.py | |
import ctypes | |
fooz = ctypes.CDLL("/home/mm/dytest/libfooz-afaf02c9-0.0.so") | |
fooz.foo(3) | |
mm@cereal:~/dytest$ python test.py | |
Cowabunga, 3 | |
mm@cereal:~/dytest$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment