Skip to content

Various experiments and demos relating to Golang talking to Rust via CGO

License

Notifications You must be signed in to change notification settings

laser/cgo-rust-ffi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cgo-rust-ffi

Various experiments and demos relating to Golang talking to Rust via CGO. This gave me a good excuse to mess around with SHM_GET, SHM_OPEN, MMAP, and mkfifo.

Examples

  1. (DONE) Generate header from Rust API
  2. (DONE) Generate CGO from previously-generated header
  3. (DONE) Go calls Rust through CGO and streams bytes using FIFO file (named pipe)
  4. (DONE) Go calls Rust through CGO, sharing memory (uses SHM_OPEN + MMAP)
  5. (WIP) Go allocates slice in C heap, copies from Go heap and passes pointers to Rust
  6. (WIP) Go calls Rust through CGO and streams bytes over TCP socket

Tools

  1. Go buy a Mac: https://apple.com
  2. Install Rust: curl https://sh.rustup.rs -sSf | sh
  3. Install Golang: https://golang.org/dl/
  4. Install c-for-go: go get github.com/xlab/c-for-go

Caveats

  1. This software has been tested with OSX only

Build and Run Tests

To build and run demos:

  • cd hasher && make ; cd ..
  • go run main.go

About

Various experiments and demos relating to Golang talking to Rust via CGO

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published