From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id A41B07FA80 for ; Sat, 24 Oct 2015 11:50:38 +0200 (CEST) IronPort-PHdr: 9a23:tDH0wRMRNUpEO89zHv0l6mtUPXoX/o7sNwtQ0KIMzox0KPr8rarrMEGX3/hxlliBBdydsKIZzbKO+4nbGkU+or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6anHS+4HYoFwnlMkItf6KuStOU15z//tvx0qOQSj0AvCC6b7J2IUf+hiTqne5Sv7FfLL0swADCuHpCdrce72ppIVWOg0S0vZ/or9YwuxhX7rgq/stEFKH7ZLgQTLpCDT1gPXp/rJngvBzHCA+O/Wc0U2MMkxMODRKTvz/gWZKk+BD9u+Vhwi6CeYXTTLs0UDmmpe8/TR7jiC4KM3gi92zYltZ3lIpapg6so1p0xIuCM9LdD+Z3Yq6IJYBSfmFGRMsEDyE= Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=michael.soegtrop@intel.com; spf=Pass smtp.mailfrom=michael.soegtrop@intel.com; spf=None smtp.helo=postmaster@mga02.intel.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of michael.soegtrop@intel.com) identity=pra; client-ip=134.134.136.20; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="michael.soegtrop@intel.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of michael.soegtrop@intel.com designates 134.134.136.20 as permitted sender) identity=mailfrom; client-ip=134.134.136.20; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="michael.soegtrop@intel.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mga02.intel.com) identity=helo; client-ip=134.134.136.20; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="michael.soegtrop@intel.com"; x-sender="postmaster@mga02.intel.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0BLAAAlUytWnBSIhoZdgmmBIW8GvjMBDSOBNxcBAYYEAoEsOBQBAQEBAQEBARABAQEBAQYNCQkhIwuCK4IJBS0cQgEYEhk9FwEOAQQbiCcBoyuiKgwhhnmJWIJmDEMdgRQFljYBqVAfAQGCUxYHFoE/coYSgQYBAQE X-IPAS-Result: A0BLAAAlUytWnBSIhoZdgmmBIW8GvjMBDSOBNxcBAYYEAoEsOBQBAQEBAQEBARABAQEBAQYNCQkhIwuCK4IJBS0cQgEYEhk9FwEOAQQbiCcBoyuiKgwhhnmJWIJmDEMdgRQFljYBqVAfAQGCUxYHFoE/coYSgQYBAQE X-IronPort-AV: E=Sophos;i="5.20,192,1444687200"; d="scan'208,217";a="151625904" Received: from mga02.intel.com ([134.134.136.20]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Oct 2015 11:50:36 +0200 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 24 Oct 2015 02:50:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,192,1444719600"; d="scan'208,217";a="834029799" Received: from irsmsx103.ger.corp.intel.com ([163.33.3.157]) by orsmga002.jf.intel.com with ESMTP; 24 Oct 2015 02:50:34 -0700 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.98]) by IRSMSX103.ger.corp.intel.com ([169.254.3.116]) with mapi id 14.03.0248.002; Sat, 24 Oct 2015 10:50:34 +0100 From: "Soegtrop, Michael" To: "caml-list@inria.fr" Thread-Topic: flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries? Thread-Index: AdEOQWsyPDiuTuX3RGe00BbDnTwYuQ== Date: Sat, 24 Oct 2015 09:50:33 +0000 Message-ID: <0F7D3B1B3C4B894D824F5B822E3E5A172CE331EE@IRSMSX102.ger.corp.intel.com> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.182] Content-Type: multipart/alternative; boundary="_000_0F7D3B1B3C4B894D824F5B822E3E5A172CE331EEIRSMSX102gercor_" MIME-Version: 1.0 Subject: [Caml-list] flexdll circular dependency on ocamlc: Impossible to built ocaml for mingw without using some prebuilt binaries? --_000_0F7D3B1B3C4B894D824F5B822E3E5A172CE331EEIRSMSX102gercor_ Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 scra= tch? 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 the= n the MingW Ocaml, but then flexlink depends on the Cygwin dlls. I am not s= ure how bad this is but I think ocamlc needs flexlink later as well when li= nking MingW apps. Also the effort of this is rather high. So I used a prebu= ilt flexlink/flexdll but I don't really like this. Also I wonder why flexdll/flexlink is required. The documentation of flexdl= l states: Windows DLL cannot refer to symbols defined in the main application or in p= reviously 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 ac= cess 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 onc= e. 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 sup= port 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 an= d 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 --_000_0F7D3B1B3C4B894D824F5B822E3E5A172CE331EEIRSMSX102gercor_ Content-Type: text/html; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable

Dear Ocaml Users,

 

building Ocaml for Mingw on Cygwin I came across a s= trange effect: flexdll (or flexlink) depends on the Ocaml compiler and the = Ocaml compiler depends on flexdll. I wonder how one is supposed to build Oc= aml 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 Oca= ml, but then flexlink depends on the Cygwin dlls. I am not sure how bad thi= s is but I think ocamlc needs flexlink later as well when linking MingW apps. Also the effort of this is rather h= igh. So I used a prebuilt flexlink/flexdll but I don’t really like th= is.

 

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 usi= ng MSVC one can declare functions in the main executable as DLL-export. The= n 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 fu= nctions  in the main executable. The same is true for any other dlls a= lready loaded. I don’t do this every day but I did this more than onc= e. 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 i= s 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

--_000_0F7D3B1B3C4B894D824F5B822E3E5A172CE331EEIRSMSX102gercor_--