X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A38A9388A805
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1589781810;
	bh=o5a6AKxludUwaRSUfV7EvQEZL07MtgfSLctUrsaH26w=;
	h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=JQtojA6/RNaMWAiRfr6+oCIx6AvDGTWsWENJCQxQxuNW6wWlu3lx8CtdvYDiAwA/N
	 OwauSL0V4/tM8AbucWhk/cjfUdjMxyra3RIkFlhQjOeGXzkWLpmhAWby79AHxTvye3
	 kdJvMovKnwzm6/L72x5IFejgDFnjcX5gx3CrT/W0=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73C2A386F02B
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)
Subject: Re: Cannot use Cygwin64 with MSVC 64-bit DLL
To: cygwin@cygwin.com
References: <SYBPR01MB36418FFAC8D8A0AF8EBE6E8BCCBB0@SYBPR01MB3641.ausprd01.prod.outlook.com>
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: <SYBPR01MB36418FFAC8D8A0AF8EBE6E8BCCBB0@SYBPR01MB3641.ausprd01.prod.outlook.com>
Content-Language: it
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 <cygwin.cygwin.com>
List-Unsubscribe: <http://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <http://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Marco Atzeri via Cygwin <cygwin@cygwin.com>
Reply-To: Marco Atzeri <marco.atzeri@gmail.com>
Content-Type: text/plain; charset="utf-8"; Format="flowed"
Errors-To: cygwin-bounces@cygwin.com
Sender: "Cygwin" <cygwin-bounces@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 04I63xgm007371

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

--
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

