caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremie Dimino <jdimino@janestreet.com>
To: Kenneth Adam Miller <kennethadammiller@gmail.com>
Cc: caml users <caml-list@inria.fr>, Anton Lavrik <alavrik@piqi.org>
Subject: Re: [Caml-list] Utop Difficulties with C callbacks
Date: Fri, 20 Mar 2015 09:43:25 +0000	[thread overview]
Message-ID: <CANhEzE7HW1pQkR0cU_m5Z=iXKUNjTFaH7ggVymd8ha4pbwJ2vg@mail.gmail.com> (raw)
In-Reply-To: <CAK7rcp8hpnCUJT8Qo7ogCfhXKSXSTPJJtYSoap3PXYV7Z9q7rw@mail.gmail.com>

On Thu, Mar 19, 2015 at 9:36 PM, Kenneth Adam Miller
<kennethadammiller@gmail.com> wrote:
> ocamlfind ocamlc -ccopt "-fPIC -DPIC -shared -DNATIVE_CODE  -o
> piqi_c_impl.so " piqi_c_impl.c

I don't think this command will do what you expect. You can use
ocamlmklib instead:

  ocamlfind ocamlmklib -o piqilib_stubs piqi_c_impl.o

This will create dllpiqilib_stubs.so and libpiqilib_stubs.a. You can
use -verbose to see what it is running. You need to install the
dllpiqilib_stubs.so file with ocamlfind as well, it will put it where
ocamlrun can find it.

> ocamlfind ocamlc -a -custom             -dllib piqilib_stubs    -o
> piqilib.cma piqi_version.cmo piqi_piqirun.cmo piqi_piqi.cmo piqloc.cmo
> piqi_util.cmo piq_ast.cmo piqi_impl_piqi.cmo piqi_boot.cmo piqi_c.cmo
> piqi_config.cmo piqi_iolist.cmo piqi_name.cmo piqi_common.cmo piqi_file.cmo
> piqi_command.cmo piqi_protobuf.cmo piqi_db.cmo piq_lexer.cmo piq_parser.cmo
> piq_gen.cmo piqi_objstore.cmo piqobj.cmo piqobj_common.cmo
> piqobj_to_protobuf.cmo piqobj_of_protobuf.cmo piqobj_to_piq.cmo
> piqobj_of_piq.cmo piq.cmo piqi.cmo piqi_pp.cmo piqi_json_parser.cmo
> piqi_json_gen.cmo piqi_json.cmo piqi_base64.cmo piqobj_to_json.cmo
> piqobj_of_json.cmo piqi_xml.cmo piqobj_to_xml.cmo piqobj_of_xml.cmo
> piqi_convert.cmo piqi_compile.cmo piqi_light.cmo piqi_getopt.cmo
> cp piqi_c_impl.so piqilib_stubs.so
> utop -require mylib

AFAIK the only effect of -custom on a library is to require -custom
linking when linking an executable, so you probably don't want it
here. You should also keep the -cclib for when you do want to link a
custom executable. In the end it should look like this:

  ocamlfind ocamlc -a -cclib -lpiqilib_stubs -dllib -lpiqilib_stubs -o
piqilib.cma <cmo files>

-- 
Jeremie

  reply	other threads:[~2015-03-20  9:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 18:19 Kenneth Adam Miller
2015-03-19 19:01 ` Jeremie Dimino
2015-03-19 19:33   ` Kenneth Adam Miller
2015-03-19 21:36     ` Kenneth Adam Miller
2015-03-20  9:43       ` Jeremie Dimino [this message]
2015-03-20  9:57         ` Daniel Bünzli
2015-03-20 14:51           ` Kenneth Adam Miller
2015-03-20 15:02             ` 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='CANhEzE7HW1pQkR0cU_m5Z=iXKUNjTFaH7ggVymd8ha4pbwJ2vg@mail.gmail.com' \
    --to=jdimino@janestreet.com \
    --cc=alavrik@piqi.org \
    --cc=caml-list@inria.fr \
    --cc=kennethadammiller@gmail.com \
    /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).