caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] building and using a library in a subdirectory
@ 2015-09-22  6:23 Martin DeMello
  2015-09-22  6:45 ` Gabriel Scherer
  2015-09-22  6:46 ` Martin DeMello
  0 siblings, 2 replies; 9+ messages in thread
From: Martin DeMello @ 2015-09-22  6:23 UTC (permalink / raw)
  To: OCaml List

[-- Attachment #1: Type: text/plain, Size: 1452 bytes --]

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

<gui.*>: 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

[-- Attachment #2: Type: text/html, Size: 2889 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-22 19:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-22  6:23 [Caml-list] building and using a library in a subdirectory Martin DeMello
2015-09-22  6:45 ` Gabriel Scherer
2015-09-22  6:52   ` Martin DeMello
2015-09-22  6:58     ` Gabriel Scherer
2015-09-22  7:09       ` Martin DeMello
2015-09-22  7:45         ` Gabriel Scherer
2015-09-22 19:02           ` Martin DeMello
2015-09-22 19:22             ` Christian Lindig
2015-09-22  6:46 ` Martin DeMello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).