Code Monkey home page Code Monkey logo

rust-sharedmem-ocaml's Introduction

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.

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 <boost/interprocess/ipc/message_queue.hpp>

Ocaml & dune

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

Quickstart

Once the environment is properly installed, run following scripts to update C++ library and its wrappers:

cd shareMemCpp/
./install.sh
./setup.sh  // run only one time. It creates symlinks to Cpp library for Ocaml and Rust wrappers

cd ../sharedMemRs/
./install.sh

cd ../sharedMemMl/
./install.sh

cd ../

Once the wrappers are succefully built, run following commands to start-up applications:

cd node/          // Node(Rust) must be started first
cargo build 
cargo run

cd ../protocol    // Protocol(Ocaml) second
dune exec ./protocol.exe

SharedMemCpp Build & Install instructions

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

cd sharedMemRs
cargo build

// To run tests
cargo test

// for quick install run
./install.sh

SharedMemMl Build instructions

SharedMemMl building

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 build

dune 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

cd node/
cargo build
cargo run

Ocaml Protocol Build instructions

cd protocol/

dune build protocol.exe
./_build/default/protocol.exe

or

dune exec ./protocol.exe

rust-sharedmem-ocaml's People

Contributors

jakubfornadel avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

matuskysel

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.