From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 269D5BBAF for ; Wed, 25 Aug 2010 08:51:43 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Al8CAANadExRZ90wkWdsb2JhbACgORUBAQEBCQsKBxEDH7wnhTcEiXc X-IronPort-AV: E=Sophos;i="4.56,267,1280700000"; d="scan'208";a="66091556" Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]) by mail1-smtp-roc.national.inria.fr with ESMTP; 25 Aug 2010 08:51:42 +0200 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20100825065138.SKRK3192.mtaout02-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com>; Wed, 25 Aug 2010 07:51:38 +0100 Received: from romulus.metastack.com ([81.102.132.77]) by aamtaout03-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20100825065138.JDKO13964.aamtaout03-winn.ispmail.ntl.com@romulus.metastack.com>; Wed, 25 Aug 2010 07:51:38 +0100 Received: from remus.metastack.local ([172.16.0.1]) by romulus.metastack.com (8.14.2/8.14.2) with ESMTP id o7P6pYr1029178 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Wed, 25 Aug 2010 07:51:35 +0100 Received: from Remus.metastack.local ([fe80::547c:3c42:e1da:eda2]) by Remus.metastack.local ([fe80::547c:3c42:e1da:eda2%11]) with mapi; Wed, 25 Aug 2010 07:50:52 +0100 From: David Allsopp To: Paul Steckler , "caml-list@yquem.inria.fr" Subject: RE: [Caml-list] Dynlink native library for ocaml-mingw32 Thread-Topic: [Caml-list] Dynlink native library for ocaml-mingw32 Thread-Index: AQHLRAFDR7k3yRPPYUeK0Ma6t4AQyZLxtxZb Date: Wed, 25 Aug 2010 06:50:52 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-GB X-MS-Has-Attach: X-MS-TNEF-Correlator: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Organization: MetaStack Solutions Ltd. X-Scanned-By: MIMEDefang 2.65 on 81.102.132.77 X-Cloudmark-Analysis: v=1.1 cv=4QByPj+6Iq2k/6L54d+eVKTdgQxdscpRskJJReCfdXo= c=1 sm=0 a=xDmAcq5U_20A:10 a=kj9zAlcOel0A:10 a=xqWC_Br6kY4A:10 a=N_d7Bgv0AAAA:8 a=zrQ2JBzce-WsHTsgmecA:9 a=lPTEZN-rIEs2QZZY788A:7 a=Th1Qd302-i9Km2-HykBPoxQs_7oA:4 a=CjuIK1q_8ugA:10 a=eFNjdmzpeakA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 X-Spam: no; 0.00; dynlink:01 steckler:01 mingw:01 native-code:01 threading:01 dynlink:01 segfaults:01 cmxa:01 -wl:01 mingw:01 makefile:01 -wl:01 makefile:01 gcc:01 cmxa:01 Paul Steckler wrote:=0A= > I have a Fedora 11 instance where I've installed=0A= > mingw32-ocaml-3.11.0-0.16.beta1.fc11.noarch to create Windows=0A= > executables. I've mentioned issues with the native-code threading=0A= > libraries in that distribution before on this list.=0A= > =0A= > Recently, I added calls into the dynlink library in my code (see my=0A= > recent posts about dynlink-induced/revealed segfaults -- I'll discuss=0A= > progress in resolving these in a future post). When compiling with=0A= > ocaml-mingw32, I first had to change the dynlink/META file to look for=0A= > dynlink.cmxa to link against native code. The link failed, though,=0A= > because options -Wl and -E were being passed to FlexDLL. I have=0A= > mingw32-flexdll-0.11-9.fc11.i386 installed.=0A= > =0A= > The file Makefile.config, found in the ocaml-mingw32 library=0A= > directory, contains the line:=0A= > =0A= > NATDYNLINKOPTS=3D-Wl,-E=0A= =0A= Makefile.config on an actual 3.11 MinGW installation does not contain NATDY= NLINKOPTS, so this is incorrect. That's technically also a linker option wr= apped in a gcc option...=0A= =0A= > which options seem to get baked into dynlink.cmxa. I hacked the=0A= > library file to change those options to spaces, and the link proceeds=0A= > normally. That works, but my sleep patterns have become disturbed.=0A= > :-)=0A= > =0A= > Is this issue particular to my installation, or should dynlink.cmxa=0A= > have been built not to invoke these flags? Why does FlexDLL get=0A= > invoked as the linker, rather than i686-pc-mingw32-ld (which would=0A= > have accepted those flags)?=0A= =0A= All linking is done using flexlink for Windows distributions of ocaml - in = a highly simplified nutshell, flexlink builds some wrapper files which impl= ement dynamic linking (not to be confused with dynlink - flexlink does this= for all Windows executables) and then calls the correct compiler and linke= r to produce the final program/library. You can either use ocamlopt -verbos= e to see the flexlink call and then run it manually or use ocamlopt -verbos= e -ccopt -v to have flexlink display the programs it's invoking. Alain's we= bsite (http://alain.frisch.fr/flexdll.html) has more info on how it works..= .=0A= =0A= =0A= David=