caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "François Bobot" <francois.bobot@cea.fr>
To: "Stéphane Glondu" <steph@glondu.net>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Dependencies between plugins
Date: Tue, 14 Apr 2015 14:45:50 +0200	[thread overview]
Message-ID: <552D0BFE.7000904@cea.fr> (raw)
In-Reply-To: <552CE242.9050307@glondu.net>

On 14/04/2015 11:47, Stéphane Glondu wrote:
> Le 14/04/2015 10:59, François Bobot a écrit :
>>>> Are there any movement in this direction, or this patches will die?
>>>
>>> Don't think so. Slowness on my side.
>>
>> On my side, I haven't yet written the documentation. My main impediment
>> is to choose which predicates to use for the cmxs in the META file:
>> 1) to keep archive(plugin,native) because it is the defacto standard
>> 2) to move to something that is semantically right:
>> archive(native_plugin) or archive(shared).
>
> Sorry, I didn't follow the whole discussion but... this looks like
> hardcoding a special treatment of plugins for the native case,
> forgetting the bytecode case. Would you introduce byte_plugin (or a
> bytecode counterpart to "shared" which looks bad to me) as well?

The fact is that native and bytecode are not symmetric:
              | byte  | native
static link  | cmo   | cmx
dynamic link | cmo   | cmxs

So for bytecode we can still use `archive(byte)`. If someone wants its library to be loaded 
differently in static linking and dynamic linking e can use `archive(byte,plugin)`.

You are right that I should give a full proposal (I'm going to go with `shared` instead of 
`native_plugin` because it is short and correspond to the ocamlopt option):

1. In META file:
   1.1 use `archive(byte)` and `archive(native)` for the files to statically link
   1.2 use `archive(byte,plugin)` for the files to dynamically link in bytecode if they are 
different from the static one
   1.3 use `archive(shared)` for the files that are dynamically linked in native code

2. During dynamic loading:
   2.1. in bytecode: look for variable `archive` with predicates `byte`,`plugin` and the other 
predicates used during compilation (`mt`, `mt_posix`, `mt_vm`, `gprof`, ...)
   2.2  in native: look for variable `archive` with predicates `shared`, `plugin` and the other 
predicates used during static linking except `native`


My goal is just that when you ask in native code "Does this library define files for dynamic 
linking" the answer is not "yes, it defines these cmx". There are other solutions (like asking that 
file to statically link are define with `archive(native,-plugin)`) but they seem to be less 
conservative.

 > Even
 > code using Dynlink should be as generic (w.r.t. native/bytecode) as
 > possible...


The examples of tools that use dependencies between plugins gathered at the start of the discussion 
are already not generic (w.r.t. native/bytecode) :

The following code makes a differences between bytecode and native code:
https://github.com/ocsigen/ocsigenserver/blob/master/src/baselib/ocsigen_loader.ml#L165
https://github.com/zoggy/stog/blob/e83c363c83465a7bfd1595816b3d9bc8331af560/stog_dyn.ml#L119-L146

This one works only for native code, it seems:
https://github.com/hammerlab/ketrew/blob/master/src/lib/pure/ketrew_plugin.ml#L52

The proposed modification is to replace (for example in ocsigen):

```ocaml
(if Ocsigen_config.is_native then "native" else "byte")
```

by

```ocaml
(if Ocsigen_config.is_native then "shared" else "byte")
```

-- 
François


  reply	other threads:[~2015-04-14 12:45 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 13:15 François Bobot
2015-03-03 13:40 ` Gabriel Scherer
2015-03-03 14:23   ` François Bobot
2015-03-03 14:31     ` Maxence Guesdon
2015-03-03 14:32     ` Ivan Gotovchits
2015-03-03 14:42       ` Sebastien Mondet
2015-03-03 15:02         ` François Bobot
2015-03-03 15:24           ` Sebastien Mondet
2015-03-03 14:51       ` François Bobot
2015-03-03 14:55 ` Gerd Stolpmann
2015-03-04  9:58   ` François Bobot
2015-04-13 19:27     ` Ivan Gotovchits
2015-04-13 19:29       ` Gerd Stolpmann
2015-04-14  8:59         ` François Bobot
2015-04-14  9:47           ` Stéphane Glondu
2015-04-14 12:45             ` François Bobot [this message]
2015-04-27  9:51               ` Gerd Stolpmann
2015-04-27 10:16                 ` Gabriel Scherer
2015-04-27 12:16                   ` François Bobot
2015-04-27 12:32                     ` Daniel Bünzli
2015-04-29 12:00                   ` Gerd Stolpmann
2015-04-27 11:55                 ` François Bobot
     [not found]   ` <1735_1425463114_54F6D748_1735_16789_8_54F6D731.3090004@cea.fr>
2015-03-06 11:45     ` François Bobot
2015-04-14 12:21 ` Gabriel Kerneis

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=552D0BFE.7000904@cea.fr \
    --to=francois.bobot@cea.fr \
    --cc=caml-list@inria.fr \
    --cc=steph@glondu.net \
    /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).