Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alain Frisch <alain@frisch.fr>
To: "Richard W.M. Jones" <rich@annexia.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Native dynlink and reloading modules
Date: Thu, 22 Mar 2012 13:51:57 +0100	[thread overview]
Message-ID: <4F6B206D.6030103@frisch.fr> (raw)
In-Reply-To: <20120322114710.GA21740@annexia.org>

On 03/22/2012 12:47 PM, Richard W.M. Jones wrote:
>
> I'm a bit surprised to find that native dynlink doesn't work in the
> same way as bytecode dynlink in respect to reloading the same module.
> (See attached test program)
>
> In bytecode dynlink, reloading (ie. Dynlink.loadfile) the same module
> causes the new module code to override the old module code:
>
>    $ ./dynlink_test
>    testing bytecode ...
>    a
>    b
>
> But in native dynlink, the new module is silently discarded and the
> old code appears to run:
>
>    $ ./dynlink_test
>    testing native ...
>    a
>    a
>
> I would classify this as a bug, but I'm not quite sure what is
> expected to happen.  Is there some other way to override a module as
> in bytecode?

natdynlink currenlty depends on the OS dynamic linker, we cannot control 
the semantics so precisely (you can try loadfile_private, but I'm not 
sure it would solve your issue). Note that doing Dynlink.loadfile 
several times on the same module name can break the soundness of the 
type system (if you change the implementation while keeping the same 
interface):

   http://caml.inria.fr/mantis/view.php?id=4229


So it's probably a bad idea anyway.

-- Alain

  reply	other threads:[~2012-03-22 12:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-22 11:47 Richard W.M. Jones
2012-03-22 12:51 ` Alain Frisch [this message]
2012-03-22 16:42   ` Richard W.M. Jones
2012-03-22 17:14     ` Pierre Chambart
2012-03-22 20:12       ` Richard W.M. Jones
2012-03-31 18:40         ` Richard W.M. Jones

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=4F6B206D.6030103@frisch.fr \
    --to=alain@frisch.fr \
    --cc=caml-list@inria.fr \
    --cc=rich@annexia.org \
    /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