https://github.com/jakubfornadel/rust-sharedmem-ocaml
Rust-SharedMem-Ocaml is POC implementation of two-way IPC communication between multiple independent Rust and Ocaml processes
https://github.com/jakubfornadel/rust-sharedmem-ocaml
cpp multiprocess ocaml rust wrappers
Last synced: 15 days ago
JSON representation
Rust-SharedMem-Ocaml is POC implementation of two-way IPC communication between multiple independent Rust and Ocaml processes
- Host: GitHub
- URL: https://github.com/jakubfornadel/rust-sharedmem-ocaml
- Owner: JakubFornadel
- License: mit
- Created: 2019-08-12T14:33:23.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-26T14:33:33.000Z (over 5 years ago)
- Last Synced: 2025-05-12T23:36:28.765Z (5 months ago)
- Topics: cpp, multiprocess, ocaml, rust, wrappers
- Language: C++
- Homepage:
- Size: 221 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Rust-SharedMem-Ocaml
Rust-SharedMem-Ocaml is POC implementation of two-way IPC communication between multiple independent Rust and Ocaml processes.
For that purpose, it uses Cpp library with implemented shared memory and synchronized queue inside as core of the solution. Then Rust & Ocaml wrappers(libraries) are created on top of this library, which are later used in applications.Use git to clone the repository.
```Shell
git clone https://github.com/JakubFornadel/Rust-SharedMem-Ocaml.git
```## Prerequisites
Project was developed and tested under Ubuntu.### Cpp
- cmake v. >= 3.2
- header library from boost: #include### Ocaml & dune
```Shell
sudo su
apt-get install ocaml
apt-get install opam
opam init
opam install dune// These are optional (not used at the moment)
opam install core
opam install ctypes
opam install ctypes-foreign
```### Rust
- To intall Rust, follow https://doc.rust-lang.org/cargo/getting-started/installation.html## Quickstart
Once the environment is properly installed, run following scripts to update C++ library and its wrappers:
```Shell
cd shareMemCpp/
./install.sh
./setup.sh // run only one time. It creates symlinks to Cpp library for Ocaml and Rust wrapperscd ../sharedMemRs/
./install.shcd ../sharedMemMl/
./install.shcd ../
```Once the wrappers are succefully built, run following commands to start-up applications:
```Shell
cd node/ // Node(Rust) must be started first
cargo build
cargo runcd ../protocol // Protocol(Ocaml) second
dune exec ./protocol.exe
```## SharedMemCpp Build & Install instructions
```Shell
mkdir -p sharedMemCpp/build
cd sharedMemCpp/build
cmake ../
make
cd ../// for quick install (also for Rust and Ocaml wrappers) run:
./install.sh// for one-time setup (creates symlinks to lib for Ocaml and Rust) run:
./setup.sh```
## SharedMemRs Build instructions
```Shell
cd sharedMemRs
cargo build// To run tests
cargo test// for quick install run
./install.sh
```## SharedMemMl Build instructions
SharedMemMl building
```Shell
cd sharedMemMl
// Creates symlinks to Cpp library. See https://dune.readthedocs.io/en/stable/foreign-code.html
ln -s $PWD/../sharedMemCpp/build/libSharedMemCpp.so sharedMem/libSharedMemCpp_stubs.a
ln -s $PWD/../sharedMemCpp/build/libSharedMemCpp.so sharedMem/dllSharedMemCpp_stubs.so
dune builddune install --prefix .
sudo cp -r lib/sharedMem/ ~/.opam/default/lib/
sudo cp -r lib/sharedMem_c/ ~/.opam/default/lib/
// Check https://github.com/ocaml/dune/blob/master/doc/usage.rst#finding-external-libraries - 2. worked for me, after that dune installed-libraries can see sharedMem package !// for quick install run:
./install.sh
```## Node Build instructions
```Shell
cd node/
cargo build
cargo run
```## Ocaml Protocol Build instructions
```Shell
cd protocol/dune build protocol.exe
./_build/default/protocol.exeor
dune exec ./protocol.exe
```