functional programming - Ocamlfind installed my own lib but still `Unbound module` when using my lib -


my lib has 2 files: bson.ml , bson.mli.

i have test file use let doc = bson.make ();; etc access library , fine without problem.

i build them , bson.cmx , bson.cmo


i followed where place shared utility module in ocaml? ocamlfind install.

the meta 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 post above, command used

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 use ocamlfind list, can see there

bisect              (version: 1.3) bson                (version: 0.88.1) camlp4              (version: [distributed ocaml]) 

ok, open ocaml toplevel , #require "bson". said

# #require "bson";; /users/xxx/.opam/4.00.1/lib/bson: added search path /users/xxx/.opam/4.00.1/lib/bson/bson.cmo: loaded 

finally, when begin use let doc = bson.make ();;, sayd error: unbound module bson.

why?

i installed lib, why still can not use it?

edit

i tried load via command line such ocamlbuild -use-ocamlfind -package bson test.native, still not work

figured out myself.

i should install .cmi , .o files. if without .o file, native cannot compiled.

i should use ocamlfind install bson meta _build/src/bson.cmx _build/src/bson.cmo src/bson.mli _build/src/bson.cmi _build/src/bson.o

instead of ocamlfind install bson meta _build/src/bson.cmx _build/src/bson.cmo src/bson.mli

i.e., add _build/src/bson.cmi _build/src/bson.o (please see @gasche's comment below)


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -