Skip to content

mhmmdd/rust-python-binding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Download and install Python on Windows
https://www.python.org/ftp/python/3.7.5/python-3.7.5-amd64.exe
$ python --version
Python 3.7.5

$ cargo --version
cargo 1.44.1 (88ba85757 2020-06-11)

$ rustc --version rustc 1.44.1 (c7087fe00 2020-06-17)

$ rustup --version
rustup 1.22.1 (b01adbbc3 2020-07-08)

Build Rust project mylib

$ cargo build --release

It would be .so on Linux or .dll on Windows
$ cp target/release/mylib.dll ./mylib.pyd

Raspberry Pi build

$ python3 --version
Python 3.7.3
$ which python3
/usr/bin/python3
$ PYTHON_SYS_EXECUTABLE="/usr/bin/python3" cargo build --release
$ cp target/release/libmylib.so ./mylib.so

Test on Python

$ python

Python 3.7.5 (tags/v3.7.5:5c02a39a0b, Oct 15 2019, 00:11:34) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import mylib
>>> mylib.get_result('Hi') 
'Rust says: Hi' 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages