This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mixed Ada-C program using OpenSSL library hangs on exit with Cygwin but not Cygwin64


I have a very simple mixed Ada and C language program.  My eventual goal is
to make some OpenSSL calls from an Ada main program under Cygwin.

The Ada code (a.adb):

with ada.text_io;
with system;
procedure a is
        procedure junk (px : in system.address);
        pragma import (c, junk);
        x : aliased integer := 5;
        junk (x'address);
        ada.text_io.put_line (integer'image (x));
end a;

The C code (x.c):

#include <openssl/rsa.h>
void junk (int *px)
        RSA *pRsa = RSA_new();
        RSA_free (pRsa);

I use the following commands to build the executable (a.exe):

gcc -c a.adb
gcc -c x.c
gnatbind a
gnatlink a x.o -lcrypto

When I build on Cygwin64 1.7.29(0.272/5/3) 2014-04-07 13:46 and run a.exe,
the program displays the result 6 and then drops back to the bash prompt as
expected.  Same on Fedora 20.

When I build on Cygwin (32-bit) 1.7.29(0.272/5/3) 2014-04-07 13:44 and run
a.exe, the program displays the result 6 and then hangs consuming 100% of
one CPU core until I hit Ctrl-C.

If I remove the OpenSSL calls from x.c, the hang doesn't occur.  If I
eliminate the Ada code and make the OpenSSL calls from a pure C program, the
hang doesn't occur.

GCC is version 4.8.2 and OpenSSL is version 1.0.1g under both Cygwin
environments.  I have reproduced this behavior on XP, Win 7, and Win 8.1.

Any help is appreciated.


Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]