caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: <mads379@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Creating an OPAM package that wraps c functions that can be used in a non-custom utop
Date: Fri, 21 Feb 2014 11:46:58 +0100	[thread overview]
Message-ID: <sympa.1392979560.16254.260@inria.fr> (raw)

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

             reply	other threads:[~2014-02-21 10:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21 10:46 mads379 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sympa.1392979560.16254.260@inria.fr \
    --to=mads379@gmail.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).