caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries?
@ 2015-10-24  9:50 Soegtrop, Michael
  2015-10-24 11:33 ` David Allsopp
  2015-10-24 12:13 ` Alain Frisch
  0 siblings, 2 replies; 10+ messages in thread
From: Soegtrop, Michael @ 2015-10-24  9:50 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 2046 bytes --]

Dear Ocaml Users,

building Ocaml for Mingw on Cygwin I came across a strange effect: flexdll (or flexlink) depends on the Ocaml compiler and the Ocaml compiler depends on flexdll. I wonder how one is supposed to build Ocaml for Mingw from scratch? One either needs prebuilt flexdll/flexlink or Ocaml. What does work is to first build a native Cygwin Ocaml, then flexlink using this one and then the MingW Ocaml, but then flexlink depends on the Cygwin dlls. I am not sure how bad this is but I think ocamlc needs flexlink later as well when linking MingW apps. Also the effort of this is rather high. So I used a prebuilt flexlink/flexdll but I don't really like this.

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. The same is true for any other dlls already loaded. I don't do this every day but I did this more than once. I am not sure if this also works on old Windows OSes. I think the oldest one on which I tested this is Windows 7. Also I don't know if gcc does support creating an import library when linking an executable.

If this is of interest, I could provide a small demo for this and also test it with gcc for mingw and, if someone thinks this is useful, also on XP and Vista.

Best regards,

Michael

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

[-- Attachment #2: Type: text/html, Size: 4303 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-26 12:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-24  9:50 [Caml-list] flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries? 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
2015-10-26  9:13   ` Soegtrop, Michael
2015-10-26  9:28     ` Alain Frisch
2015-10-26 12:46       ` Soegtrop, Michael

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).