From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 73C2A386F02B for ; Mon, 18 May 2020 06:03:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73C2A386F02B Received: by mail-wm1-x331.google.com with SMTP id g14so21513395wme.1 for ; Sun, 17 May 2020 23:03:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rExkf1jySfuitwpMJC1JUzOz5d5Bg581HXG1mmDuHZo=; b=c1TY2iXftw1VeE+RXgEpsjn+JwQFHUkE6Ox9DGuuP8KCK+hkBmyBURyVF0mR0jGJQB 7djIkUSkwP9q1BFUYgepXiSO/2/DsGwJLMM4Sb6c1NK8XZRkCkulwrGi1+380OY85Vaq 1SH+XTobVHYGZHJZv6Gd3g/cBlU4kG3MD2w07/g9lSq0qNPP4OHeGiP/+xMdpkKSetaS Hqydkyk3tcwj2hEzxJUI7cg7VOCiPP+xEU0GdJpihcV6X7cK1DR+BDEtXpypcjBNB0pD afPppyBaGSzPoVirGv2E1yiSzIG0HMRkPyW5Q02aLvnRsmqjJcX1rvQu6v7r6ioAludN zzkQ== X-Gm-Message-State: AOAM533E3EGIrWUbt4q5c4YNqRLEzzsliTeu9eluqBauqORcphzfko/A x8NMZGlCWyJNzikeecHQKu5TPj0p X-Google-Smtp-Source: ABdhPJy35VWbgw5cjh5Z5dtXI4oDwI0hRlNt6NSLTPWZ2tnaD+4U7+MJFb3hkErcRG4+aj+wUUlKPw== X-Received: by 2002:a1c:de05:: with SMTP id v5mr16841648wmg.1.1589781806117; Sun, 17 May 2020 23:03:26 -0700 (PDT) Received: from ?IPv6:2003:cc:9f3c:6ab9:89f6:1bdc:dfd6:ec93? (p200300cc9f3c6ab989f61bdcdfd6ec93.dip0.t-ipconnect.de. [2003:cc:9f3c:6ab9:89f6:1bdc:dfd6:ec93]) by smtp.gmail.com with ESMTPSA id q4sm2070036wma.9.2020.05.17.23.03.25 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 17 May 2020 23:03:25 -0700 (PDT) Subject: Re: Cannot use Cygwin64 with MSVC 64-bit DLL To: cygwin@cygwin.com References: From: Marco Atzeri Message-ID: <248d3c0c-c15e-d9d6-7218-477adc65b89f@gmail.com> Date: Mon, 18 May 2020 08:03:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: it Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 May 2020 06:03:29 -0000 On 17.05.2020 23:03, Old Wolf via Cygwin wrote: > Hi all > > I am ultimately trying to use Cygwin 64-bit to port a Solaris server application which uses the Informix Client SDK.  However, the Win64 version of that product comes as a binary-only distribution of DLLs built by MSVC . > > I have managed to reproduce the problem in a simple test case.  I made a full writeup here: https://stackoverflow.com/questions/61812131/ > > In brief, linking a 64-bit DLL created by MSVC with early binding to any program built with /usr/bin/gcc (or /usr/bin/g++) produces a runtime error "The procedure entry point __cxa_atexit could not be located in the dynamic link library F:\temp\mre.exe"​ . (Also, if the executable is launched from the Cygwin shell no output appears; I see this error popup by launching from command prompt). > > However the testcase does work correctly if I use late binding (i.e. LoadLibrary and GetProcAddress). But this is a considerable nuisance in comparison to early binding (i.e. linking against the DLL's import library). It also works correctly under MSYS2 , and native-target mingw-w64. Only Cygwin64 early-binding exhibits the problem. > > I don't have the option of trying to rebuild the import library as suggested in comments to my SO question, as the Informix DLL is stripped . I would like to use Cygwin as opposed to MSYS2 because the application uses SYSV IPC which is supported by Cygwin. So I need to either resolve this problem, create my own "import library" with late binding thunks for every function, or rewrite the SYSV IPC stuff to WinAPI stuff and use MSYS2 instead. Hoping the first of those three options turns out to be possible! > > Regards, > M.M. > -- the __cxa_atexit is available from the cygwin1.dll itself. Have you tried to add "-lcygwin" at the end of your command line: g++ -o mre.exe mre.cc /f/temp/simpledll/x64/Debug/simpledll.lib -lcygwin As it should be the default linking, I doubt it is that the root cause. May be the difference is in the 64 bit models https://cygwin.com/cygwin-ug-net/programming.html#gcc-64