public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* mixed Ada-C program using OpenSSL library hangs on exit with Cygwin but not Cygwin64
@ 2014-04-13 16:53 Mark Veneziano
  0 siblings, 0 replies; only message in thread
From: Mark Veneziano @ 2014-04-13 16:53 UTC (permalink / raw)
  To: cygwin

Hello,

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;
begin
        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();
        (*px)++;
        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.

Thanks,
Mark



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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-13 16:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-13 16:53 mixed Ada-C program using OpenSSL library hangs on exit with Cygwin but not Cygwin64 Mark Veneziano

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).