GithubHelp home page GithubHelp logo

ocaml-pirates / ocaml-rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zshipko/ocaml-rs

0.0 2.0 0.0 71 KB

Rust bindings to the OCaml runtime

License: ISC License

Makefile 0.78% Rust 99.22%

ocaml-rs's Introduction

ocaml-rs - OCaml extensions in Rust

Note: ocaml-rs is still experimental, please report any issues on github

ocaml-rs allows for OCaml extensions to be written directly in Rust with no C stubs. It was forked from raml with the goal of creating a safer, high-level interface.

#[macro_use]
use ocaml;
use ocaml::ToValue;

caml!(ml_beef, |parameter|, <local>, {
    let i = parameter.i32_val();
    let res = 0xbeef * i;
    println!("about to return  0x{:x} to OCaml runtime", res);
    local = res.to_value();
} -> local);

This will take care of all the OCaml garbage collector related bookkeeping (CAMLparam, CAMLlocal and CAMLreturn)

For a working example see ocaml-vec or ./examples/rust and ./examples/ocaml

Documentation

https://docs.rs/ocaml/

ocaml-rs's People

Contributors

g2p avatar zshipko avatar

Watchers

 avatar  avatar

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.