X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=sVRof3M0zVdjC7g+tLeIAsKRwHKaY6XQMMXC2ztw6+ACTu3dKcarh I56ekrZFNp4vc1vwaOAdx+VhVzTInTvEGH3efOuWPqTr/Kfof8f4Ju5cKP67o1MQ /gwOXTN8RWXpB5Kn6vhlCPPG154w+wFXiAr4ptM879MoiDTtXOFsIE= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=GDNZW5EaD98wkmzSB/oRRq8txt4=; b=qwGzIPj43TaulW0YLvAvlqGKQKRv bchAN2JD9cXHUkM7tgdYsLYBeS0AU4zfOMjvVS6FHq/ayEopgAGWToWzmELRv3iS pKGWxLeLYn0bViFEW4k9jXWOtGS0Uz1Mg100BFwwqm8BCeIkyomlb575Q2ExzwxB 9+rsoNQix5Ig2O0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-101.9 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=dll, reside, 2-1, dlls X-HELO: calimero.vinschen.de Date: Thu, 17 Dec 2015 13:43:31 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Problems using a DLL with Cygwin 64 bit Message-ID: <20151217124331.GW3507@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <567295D2 DOT 80900 AT observatorysciences DOT co DOT uk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uWbmMdDzzl2TXAgx" Content-Disposition: inline In-Reply-To: <567295D2.80900@observatorysciences.co.uk> User-Agent: Mutt/1.5.23 (2014-03-12) --uWbmMdDzzl2TXAgx Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Dec 17 11:00, Philip Taylor wrote: > Environment: > Windows 7 (64 bit) > Cygwin 64 bit > GCC version: 4.9.3 >=20 > To make use of a Prosilica camera, I am having to build applications using > an externally supplied DLL (from the camera manufacturer, with no source > code) in Cygwin64 and Cygwin32. I am using the appropriate 32 or 64 bit > version of the DLL, as supplied. I take it you simply linked against the Cygwin DLL? You're not trying to load the Cygwin DLL at runtime dynamically? All bets are off in the latter case. > The most difficult problem encountered is when using Cygwin 64 bit. I was > initially unable to link but, using pexports and dlltool, I managed to > create a .lib file with which I linked OK. This got rid of the initial li= nk > failure message "error adding symbols: File in wrong format." Linking against the externally supplied DLL you mean? I hope you didn't create another link lib for Cygwin... > But having linked successfully, the application now crashes on startup: >=20 > $ ../../bin/cygwin-x86_64/prosilicaApp.exe > 6 [main] prosilicaApp (96896) C:\cygwin64\home\EPICS\R3.14.12.5\modules= \areaDetector\2-2\ADProsilica\2-1\iocs\prosilicaIOC\bin\cygwin-x86_64\prosi= licaApp.exe: >=20 > *** fatal error - cygheap base mismatch detected - 0x1802FA400/0x6EA400. > This problem is probably due to using incompatible versions of the cygwin= DLL. > Search for cygwin1.dll using the Windows Start->Find/Search facility > and delete all but the most recent version. The most recent version *sho= uld* > reside in x:\cygwin\bin, where 'x' is the drive on which you have > installed the cygwin distribution. Rebooting is also suggested if you > are unable to find another cygwin DLL. > Segmentation fault >=20 > The reference to cygwin DLL in the long error message appears spurious - > there is only one cygwin DLL in my system and there are no problems runni= ng > other Cygwin applications in the same environment. It is spurious in this case. The Cygwin DLL is supposed to be located at address 0x180040000. The cygheap location is dependend on that since it's immediately attached to the DLL. It appears that, after either forking or execing the application, the Cygwin DLL gets loaded to an address 0x600000 or something like that. Why this happens, I have no idea. Off the top of my head it points to a few possible reasons: - The externally supplied DLL has been loaded to the 0x180000000 range. In that casse you should rebase it to an address which does not collide with other Cygwin DLLs. An address < 0x80000000 or > 0x7FF000000000 would make sense. - The externally supplied DLL has loaded data to an address in the 0x180000000 range, which would be weird, but is possible. - Your application has been built with ASLR enabled. Remove the flag (peflags -d0 your_app.exe) and try again. Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --uWbmMdDzzl2TXAgx Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWcq3zAAoJEPU2Bp2uRE+g4D4P+wTAnf60EEuDZjKOXh/cghvE hw76zkwv3C6qeZWwC3QwIyqmEzKFAZAstDalFray76HzNNWydSMKfzxEEgzDl3za PwBqCe23hOXKlERXIa0KuyG1ON65m8hRVwVpxjdhrKLbe3LeS7s3tzzhIoqVOsQU OiluWyuQczISYkCRrcuepiaPe4+bqCTPkd6P1maGAwDC/T0v+j4yK+D2d1UVIamz UosTJTgmDxBc3n64vjJZjclnfg6HZpoRqspOaJf9bdnbkDoAjbllTG/Gd2z/mNju giROhrE3zlyay4+HFAXPz+x4hiiLj00Crg9r3s+oBKGPoKhAlSSsIJG0xHdKcx43 5MXYrvZiQf9hqzlpgqVt4VztRlxSMz6AaOhHBpzXFyDxrH9PBJo6dbJDsDHIkkem bfNCEYhfo8P9vToosn/MX/sR3bfvbyYYCZhX7yPLIfS8BXlQ9o+82mgL59pa6OmK nU8lkPkgDOltDFV5M5Re6fIpAegPvmutZ+2kRTovBgdw7qOQ2fPMys7L0g5jGmjR gXbdbrT20GLTzMPbc8xx2M2E1Zrgx3/cOJauKj4qNHy1rFnBuR9t2/5fGsUmzlrz mQdrA7xCAYhLF2L2GP9vzUu+M7xZ79mhgAZYjaJTWA1NLSvVTUQjFCGANXIsKFff M94s9sKNuUrW1ILSrCyZ =1Bfu -----END PGP SIGNATURE----- --uWbmMdDzzl2TXAgx--