caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Creating an OPAM package that wraps c functions that can be used in a non-custom utop
@ 2014-02-21 10:46 mads379
  2014-02-21 11:11 ` Daniel Bünzli
  0 siblings, 1 reply; 5+ messages in thread
From: mads379 @ 2014-02-21 10:46 UTC (permalink / raw)
  To: caml-list

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

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

end of thread, other threads:[~2014-02-26 22:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-21 10:46 [Caml-list] Creating an OPAM package that wraps c functions that can be used in a non-custom utop mads379
2014-02-21 11:11 ` Daniel Bünzli
2014-02-26 21:49   ` Mads Hartmann Jensen
2014-02-26 22:33     ` Daniel Bünzli
2014-02-26 22:50     ` Daniel Bünzli

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).