public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cannot use Cygwin64 with MSVC 64-bit DLL
@ 2020-05-17 21:03 Old Wolf
  2020-05-18  6:03 ` Marco Atzeri
  0 siblings, 1 reply; 2+ messages in thread
From: Old Wolf @ 2020-05-17 21:03 UTC (permalink / raw)
  To: cygwin

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Cannot use Cygwin64 with MSVC 64-bit DLL
  2020-05-17 21:03 Cannot use Cygwin64 with MSVC 64-bit DLL Old Wolf
@ 2020-05-18  6:03 ` Marco Atzeri
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Atzeri @ 2020-05-18  6:03 UTC (permalink / raw)
  To: cygwin

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-18  6:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-17 21:03 Cannot use Cygwin64 with MSVC 64-bit DLL Old Wolf
2020-05-18  6:03 ` Marco Atzeri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).