My lib has two files: bson.ml
and bson.mli
.
I also have another test file which use let doc = Bson.make ();;
etc to access the library and it is fine without any problem.
I also successfully build them and I get bson.cmx
and bson.cmo
I then followed Where to place a shared utility module in OCaml? for ocamlfind install
.
The META is like this:
name="bson"
description="A bson data structure, including encoding/decoding"
version="0.88.1"
archive(byte)="bson.cmo"
archive(native)="bson.cmx"
As instructed from the post above, the command I used is
ocamlfind install bson META _build/src/bson.cmx _build/src/bson.cmo src/bson.mli
It said
Removed /Users/xxx/.opam/4.00.1/lib/bson
Installed /Users/xxx/.opam/4.00.1/lib/bson/bson.mli
Installed /Users/xxx/.opam/4.00.1/lib/bson/bson.cmo
Installed /Users/xxx/.opam/4.00.1/lib/bson/bson.cmx
Installed /Users/xxx/.opam/4.00.1/lib/bson/META
If I use ocamlfind list
, I can see it is there
bisect (version: 1.3)
bson (version: 0.88.1)
camlp4 (version: [distributed with Ocaml])
ok, then I open ocaml toplevel
and #require "bson"
. It said
# #require "bson";;
/Users/xxx/.opam/4.00.1/lib/bson: added to search path
/Users/xxx/.opam/4.00.1/lib/bson/bson.cmo: loaded
finally, when I begin to use it let doc = Bson.make ();;
, it sayd Error: Unbound module Bson.
Why?
I successfully installed my lib, why still can not use it?
Edit
I also tried load it via command line such as ocamlbuild -use-ocamlfind -package bson test.native
, still does not work