caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Allsopp <dra-news@metastack.com>
To: Alain Frisch <alain.frisch@lexifi.com>,
	"Soegtrop, Michael" <michael.soegtrop@intel.com>,
	"caml-list@inria.fr" <caml-list@inria.fr>
Subject: RE: [Caml-list] flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries?
Date: Mon, 26 Oct 2015 11:13:19 +0000	[thread overview]
Message-ID: <E51C5B015DBD1348A1D85763337FB6D9E9FBE362@Remus.metastack.local> (raw)
In-Reply-To: <562DF538.3040306@lexifi.com>

Alain Frisch wrote:
> On 24/10/2015 14:51, David Allsopp wrote:
> > Alain Frisch wrote:
> >> On 24/10/2015 11:50, Soegtrop, Michael wrote:
> >>> Also I wonder why flexdll/flexlink is required. The documentation of
> >>> flexdll states:
> >>>
> >>> Windows DLL cannot refer to symbols defined in the main application
> >>> or in previously loaded DLLs.
> >>>
> >>> In my experience this is not true. At least when using MSVC one can
> >>> declare functions in the main executable as DLL-export. Then when
> >>> linking the main executable an import library is created in the same
> >>> way as when building a DLL by the linker. The DLL can then link to
> >>> this import library and can access the functions  in the main
> >> executable.
> >>
> >> Dynlink follows a different model: dynlinked units are not tied to a
> >> specific main executable.  A myplugin.cmxs can be dynamically linked
> >> by any application that provides the required interfaces.
> >
> > Wouldn't that still be true with the .def/.a approach, though?
> 
> I don't see how this would work without changing the compilation model.
> Would you generate an import library for each .cmi file?

Yes - but I wasn't taking the compilation model as fixed. I was (purely hypothetically, obviously!) imagining that flexlink (or some such) linker was still there and that it would generate the appropriate .def/.a files to allow the dll to be compiled, as it would also have access to the required .cmi files. That's quite similar to what flexlink already does, isn't it - just generating an import library to trick the actual/underlying linker rather than building separate tables embedded into .o/.obj files which get linked as well. 

But... 

> Also keep in mind that currently, dynlinked code can access directly data
> symbols from the main program (not just function calls that can more
> easily go through an import library).

... that sounds like the real "elevator explanation" for why things are as they are!


David

  reply	other threads:[~2015-10-26 11:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-24  9:50 Soegtrop, Michael
2015-10-24 11:33 ` David Allsopp
2015-10-26  8:54   ` Soegtrop, Michael
2015-10-24 12:13 ` Alain Frisch
2015-10-24 12:51   ` David Allsopp
2015-10-26  9:41     ` Alain Frisch
2015-10-26 11:13       ` David Allsopp [this message]
2015-10-26  9:13   ` Soegtrop, Michael
2015-10-26  9:28     ` Alain Frisch
2015-10-26 12:46       ` Soegtrop, Michael

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=E51C5B015DBD1348A1D85763337FB6D9E9FBE362@Remus.metastack.local \
    --to=dra-news@metastack.com \
    --cc=alain.frisch@lexifi.com \
    --cc=caml-list@inria.fr \
    --cc=michael.soegtrop@intel.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).