Project structure test

Quite often, I’m sharing my OCaml work as standard shared objects (aka .so or .dll). I recently manage to compile such a project with dune.

A shared_object linking mode was recently added to dune. I tried to take advantage of it to simplify my jbuild dune files. Without success. :-(

I’m creating the current project, in order to understand how to set things (and get help on a concrete project).

Thanks to @diml who pointed my mistakes, this now works!

Tests were performed with development version of jbuilder:

$ jbuilder --version
1.0+beta19-33-g73231bf

The current version has been adapted for dune.

The lib/ directory is there to provide a two functions pure OCaml lib: mylib, which is to be shared to C users (I’ll jump later to a more complex OCaml library that will have to be linked to third parties C lib).

val add: int -> int -> int
val substract: int -> int -> int

Makefile targets

  • help
  • test
  • clean

automatic/

This directory contains a portable `dune` way to build direct.so.

test/

This directory contains a C test file that makes use of direct.so.

To test, just do make test.