Cannot use Cygwin64 with MSVC 64-bit DLL

Old Wolf ow2@outlook.co.nz
Sun May 17 21:03:33 GMT 2020


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.


More information about the Cygwin mailing list