You already have a .cma file. Now try loading that in the standard toplevel
instead of creating a custom toplevel. It should work. Once you've tested
that, you can create an OPAM package. See instructions here [1]. Once
you've uploaded your opam package to either the main repo or your private
one, your colleagues will be able to install your library by running `opam
install`. Then, finally they'll be able to run utop and do #require to load
your library.

PS: This is not a widely used mailing list. You should use the Beginners or
main OCaml List. See here [2].

[1] http://opam.ocaml.org/doc/Packaging.html
[2] http://ocaml.org/community/mailing_lists.html



On Thu, Feb 20, 2014 at 12:08 PM, Mads Hartmann Jensen <[email protected]>wrote:

> I have a small OCaml library that wraps a couple of C functions that I
> wrote. I'm able to compile the project to a .cmx?a file just fine using
> ocamlbuild.
>
> I have the following files
>
> src
>     geolocalisation_c.c
>     geolocalisation.ml
>     geolocalisation.mllib
>
> I want to be able to play around with my code in a top-level, and I'm able
> to do this just fine with the following series of commands.
>
>     ocamlbuild src/geolocalisation_c.o
>     ocamlbuild -pkgs ounit src/geolocalisation.cma
>     ocamlmktop -custom -cclib -lGeoIp _build/src/geolocalisation_c.o
> _build/src/geolocalisation.cma -o myutop
>
> To verify that it works I run
>
>     ./myutop -I _build/src/
>     #load "geolocalisation.cmo";;
>     Geolocalisation.create_context;;
>
> and I get the correct type-signature printed in the top-level.
>
> The next thing I want to do is create an OPAM package for it that my
> co-workers and I can use. My question is, will I be able to create the
> package in such a way that the library can be loaded into utop using
> topfind so we don't have to build a custom top-level in the projects that
> use this library? Basically I would like the users of the library to be
> unaware that it invokes external c functions.
>
> If it is possible, do you have any pointers to where I might find some
> information about how to do it?
>
> Cheers,
> Mads
>
> --
> --
> You received this message because you are subscribed to the Google Groups
> "ocaml-developer" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/ocaml-developer?hl=en
> For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html
> ---
> You received this message because you are subscribed to the Google Groups
> "ocaml-developer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
-- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/ocaml-developer?hl=en
For other OCaml forums, see http://caml.inria.fr/resources/forums.en.html
--- 
You received this message because you are subscribed to the Google Groups 
"ocaml-developer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to