Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alan Schmitt <alan.schmitt@polytechnique.org>
To: caml-list list <caml-list@inria.fr>
Subject: Re: [Caml-list] state of native dynlink on os x
Date: Thu, 8 Mar 2012 15:16:18 +0100	[thread overview]
Message-ID: <D58E8E4D-A8A5-468C-B796-9F4C1FAB0735@polytechnique.org> (raw)
In-Reply-To: <F21FBD70-105A-4924-A77C-8945EED58935@polytechnique.org>

On 8 mars 2012, at 12:13, Alan Schmitt wrote:

> On 27 févr. 2012, at 16:43, Damien Doligez wrote:
> 
>>> Also, when running why3, I get some undefined symbols (_camlRandom, _camlParsing, _camlString). Where are these symbols defined?
>> 
>> Looks like modules of the standard library, right ?
> 
> Regarding this, should something special be done when dynlinking a file that depends on the standard library? I assume that dependencies are not automatically loaded, but should one load the standard library first?
> 
> In other words, is this a bug in why3, or in ocaml?

Trying to get to the bottom of this, here is what I've done.

- Adapting the minimal example from http://caml.inria.fr/mantis/view.php?id=5093 I checked that I can load a plugin that uses a function from Random.
- I then tried to load a why3 plugin. It fails because it cannot find some symbol (_camlWhy3), and I could not find how to compile things to make sure why3.cmxa is linked with the plugin.
- Getting back to the basics, I tried to create a small archive of my own, which I would use in a plugin, and this is where I'm stuck. I have the following files:

test.ml:

let f () = "foo"

plugin.ml:

let s = Test.f ()
let () = print_endline s

loader.ml:

let load f = 
  try
    Dynlink.loadfile f
  with Dynlink.Error e -> print_endline (Dynlink.error_message e)
  
let () = load "plugin.cmxs"

to build everything, I do (I tried adding test.cmxa everywhere, to no avail. Everything lives in the same, current directory):

ocamlopt.opt -a -o test.cmxa test.ml
ocamlopt.opt -c -linkall -o plugin.cmx test.cmxa plugin.ml
ocamlopt.opt -shared plugin.cmx test.cmxa -o plugin.cmxs
ocamlopt.opt test.cmxa dynlink.cmxa loader.ml -o loader.native

When I run "./loader.native", I get:

no implementation available for Test

I googled this error and could only find references to problem related to the (deprecated) Dynlink.add_interfaces, which is not even supposed to work natively.

What am I doing wrong?

Thanks,

Alan



  reply	other threads:[~2012-03-08 14:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-15 11:17 Alan Schmitt
2012-02-15 12:34 ` Daniel Bünzli
2012-02-15 14:16   ` Alan Schmitt
2012-02-17  6:47 ` Alan Schmitt
2012-02-27 15:43   ` Damien Doligez
2012-02-27 17:49     ` Pierre-Alexandre Voye
2012-02-28 10:15       ` David MENTRE
2012-02-28 10:32         ` Pierre-Alexandre Voye
2012-02-28 15:34     ` Alan Schmitt
2012-02-29  8:33       ` Alan Schmitt
2012-03-07 10:55       ` Damien Doligez
2012-03-07 15:14         ` Alan Schmitt
2012-03-08 11:13     ` Alan Schmitt
2012-03-08 14:16       ` Alan Schmitt [this message]
2012-03-08 14:23         ` Pierre-Alexandre Voye
2012-03-08 14:35           ` Alan Schmitt
2012-03-08 15:50             ` Pierre-Alexandre Voye
2012-03-08 16:19               ` Jérémie Dimino
2012-03-08 16:16         ` Gabriel Scherer
2012-03-08 16:25           ` Jérémie Dimino
2012-03-08 16:31             ` Alan Schmitt

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=D58E8E4D-A8A5-468C-B796-9F4C1FAB0735@polytechnique.org \
    --to=alan.schmitt@polytechnique.org \
    --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