It's me, again.. I am working on an OCaml
project and I would like to use Oasis
to build the whole code base. Here is how my codebase is organized.
src/
core/
init.ml
type.ml
utils.ml
plugin/
main.ml
I firstly only build the library with the following _oasis
file:
Library "engine"
Path: src/core
Modules:
Init,
Type,
Utils
BuildDepends: deriving, deriving.syntax, core, batteries
XMETADescription: core engine
And it works fine. There is no error and I can find a library engine.a
in the _build/src/core
folder.
However, when I try to include the library in the main.ml
with the following way:
Module T = Engine.Type
...
And compile with the following _oasis
file:
Library "engine"
Path: src/core
Modules:
Init,
Type,
Utils
BuildDepends: deriving, deriving.syntax, core, batteries
XMETADescription: core engine
Executable "main"
Path: src/plugin
MainIs: main.ml
CompiledObject: best
Install: false
BuildDepends: core, batteries, engine
I got an error:
Unbound module Engine
Am I doing anything wrong here? Could anyone give me some help? Thank you!
Your _oasis
module defines a library with the name engine
but it does not define an Engine
module. So your Init
, Type
and Utils
modules are exposed and should be accessible directly without any prefix.
If you want to pack those modules into a parent you can:
engine.ml
filePack: true
in the Library
section of your _oasis
file which would pack the included modules into a module called Engine