https://github.com/zshipko/rust-ocaml-starter
https://github.com/zshipko/rust-ocaml-starter
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zshipko/rust-ocaml-starter
- Owner: zshipko
- Created: 2022-06-01T17:29:24.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-09T19:26:01.000Z (over 3 years ago)
- Last Synced: 2025-04-10T14:02:56.979Z (about 1 year ago)
- Language: Shell
- Size: 10.7 KB
- Stars: 6
- Watchers: 2
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rust-ocaml-starter
An example project using [ocaml-rs](https://github.com/zshipko/ocaml-rs) to link an OCaml library into a Rust program.
If you're looking for an example of calling into Rust from OCaml take a look at [ocaml-rust-starter](https://github.com/zshipko/ocaml-rust-starter)
## New project checklist
- [ ] Update `README.md`
- [ ] Update the project name in `dune-project`
- [ ] Update the crate name in `Cargo.toml`
- [ ] Update `lib/dune` and `lib/dune` with the name of your project in place of `rust_ocaml_starter`/`rust-ocaml-starter`
- [ ] Rename `rust-ocaml-starter.opam` to match the name of your project
- [ ] Remove `lib/rust_ocaml_starter.ml` add your own OCaml files
- [ ] Edit `src/lib.rs`
Many of the renaming steps can be automated using `init.sh`:
```shell
$ ./init.sh my_project my-project
```
`init.sh` accepts two arguments: the `name` of the OCaml project and the `public_name`, if they are the same then one argument is acceptable.
NOTE: `init.sh` is destructive and can only be executed once (it will remove itself) - make sure you have no modifications that you want to keep before running `init.sh`.
## Building
Optionally create a local OPAM switch (choose the version you prefer):
```
opam update
opam switch create . ocaml-base-compiler.4.14.0
eval $(opam env) && opam switch
opam install dune
```
Then:
cargo build
to run the program:
cargo run