Update examples for Rust master
This commit is contained in:
@@ -4,12 +4,11 @@ else
|
||||
EXT := so
|
||||
endif
|
||||
|
||||
all: target/libdouble_input.so
|
||||
all: target/debug/libdouble_input.$(EXT)
|
||||
python src/main.py
|
||||
|
||||
target/libdouble_input.so: src/lib.rs Cargo.toml
|
||||
target/debug/libdouble_input.$(EXT): src/lib.rs Cargo.toml
|
||||
cargo build
|
||||
(cd target && ln -nsf debug/libdouble_input-*$(EXT) libdouble_input.so)
|
||||
|
||||
clean:
|
||||
rm -rf target
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
from ctypes import cdll
|
||||
from sys import platform
|
||||
|
||||
lib = cdll.LoadLibrary('target/libdouble_input.so')
|
||||
if platform == "darwin":
|
||||
ext = "dylib"
|
||||
else:
|
||||
ext = "so"
|
||||
|
||||
lib = cdll.LoadLibrary('target/debug/libdouble_input.' + ext)
|
||||
double_input = lib.double_input
|
||||
|
||||
input = 4
|
||||
|
||||
Reference in New Issue
Block a user