I finally found http://ocaml.org/learn/tutorials/ocamlbuild/Using_internal_libraries.html (which didn't come up earlier because I was searching for "subdirectory"); following that I added a myocamlbuild file: $ cat myocamlbuild.ml open Ocamlbuild_plugin let () = dispatch begin function | After_rules -> ocaml_lib "plugins/puz/Puz_plugin"; | _ -> () end but then attempting to add to the _tags file: : use_puz_plugin gave me the following: Warning: the tag "use_puz_plugin" is not used in any flag or dependency declaration, so it will have no effect; it may be a typo. Otherwise you can use `mark_tag_used` in your myocamlbuild.ml to disable this warning. + ocamlfind ocamlc -c -g -thread -package core_kernel -I plugins/puz -o file.cmo file.ml File "file.ml", line 5, characters 2-17: Error: Unbound module Puz_plugin Feedback on the tutorial: It would be useful to have a complete repository corresponding to each of the examples, that could be checked out and played with. martin On Mon, Sep 21, 2015 at 11:23 PM, Martin DeMello wrote: > If I have my project set up like this: > > . > ├── file.ml > ├── plugins > │ └── puz > │ ├── puz_bin.ml > │ ├── puz_match.ml > │ ├── puz.ml > │ ├── puz_plugin.mllib > │ ├── puz_types.ml > │ └── puz_utils.ml > └── _tags > > $ cat plugins/puz/puz_plugin.mllib > Puz Puz_bin Puz_match > > This works: > > $ ocamlbuild -use-ocamlfind plugins/puz/puz_plugin.cmxa > Finished, 22 targets (3 cached) in 00:00:03. > > My _tags file: > ------------------------------------------------ > $ cat _tags > true: thread,debug > true: package(core_kernel) > > "plugins/puz": include > > : package(labltk) > <**/puz.*>: package(unix), package(str), package(core_kernel), > package(bitstring), package(mikmatch_pcre) > <**/*_bin.*>: package(bitstring.syntax), syntax(bitstring) > <**/*_match.*>: package(mikmatch_pcre), syntax(camlp4o) > ------------------------------------------------ > > But I can't figure out how to use this library in my main program. This is > a minimal example of what I'm trying to do, not working of course: > > $ cat file.ml > open Core_kernel.Std > > let read fname = > let data = In_channel.read_all fname in > Puz_plugin.read data > > $ ocamlbuild -use-ocamlfind file.native > + ocamlfind ocamlc -c -g -thread -package core_kernel -I plugins/puz -o > file.cmo file.ml > File "file.ml", line 5, characters 2-17: > Error: Unbound module Puz_plugin > > martin >