public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: ada/6946: problem with Ada DLL made with GNAT, invoked by C code
@ 2002-06-07  0:46 Florian Weimer
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2002-06-07  0:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR ada/6946; it has been noted by GNATS.

From: Florian Weimer <fw@deneb.enyo.de>
To: KUHLMANCJ@NSWC.NAVY.MIL
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: ada/6946: problem with Ada DLL made with GNAT, invoked by C
 code
Date: Fri, 07 Jun 2002 09:38:52 +0200

 KUHLMANCJ@NSWC.NAVY.MIL writes:
 
 >>Release:        gnat3.14
 
 We do not support this release.  Please try GCC 3.1 and report back if
 the error persits.


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

* Re: ada/6946: problem with Ada DLL made with GNAT, invoked by C code
@ 2003-01-01 18:41 neroden
  0 siblings, 0 replies; 4+ messages in thread
From: neroden @ 2003-01-01 18:41 UTC (permalink / raw)
  To: KUHLMANCJ, gcc-bugs, gcc-prs, nobody

Synopsis: problem with Ada DLL made with GNAT, invoked by C code

State-Changed-From-To: feedback->closed
State-Changed-By: neroden
State-Changed-When: Wed Jan  1 10:41:06 2003
State-Changed-Why:
    No feedback for 6 months.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6946


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

* Re: ada/6946: problem with Ada DLL made with GNAT, invoked by C code
@ 2002-06-07  0:40 fw
  0 siblings, 0 replies; 4+ messages in thread
From: fw @ 2002-06-07  0:40 UTC (permalink / raw)
  To: KUHLMANCJ, gcc-bugs, gcc-prs, nobody

Synopsis: problem with Ada DLL made with GNAT, invoked by C code

State-Changed-From-To: open->feedback
State-Changed-By: fw
State-Changed-When: Fri Jun  7 00:40:52 2002
State-Changed-Why:
    GNAT 3.14 is not an FSF version.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6946


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

* ada/6946: problem with Ada DLL made with GNAT, invoked by C code
@ 2002-06-06  6:56 KUHLMANCJ
  0 siblings, 0 replies; 4+ messages in thread
From: KUHLMANCJ @ 2002-06-06  6:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6946
>Category:       ada
>Synopsis:       problem with Ada DLL made with GNAT, invoked by C code
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 06 06:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     chris kuhlman
>Release:        gnat3.14
>Organization:
>Environment:
Windows NT4.0
>Description:
I have C source.  Compile with MS Visual Studio C++ 6.0.
I have an Ada DLL.  Compiled with gnat 3.14.
The main is in C.

There is a problem with Ada input and output (I/O) initialization and finalization when an Ada DLL that has I/O is initialized and finalized more than one time from within a C code.  It is detailed below.

I have initialize and finalize invocations in the C code for the Ada procedures contained in the DLL.  If I execute the code once through, all is fine.  If, however, I put a FOR loop (say five loops) around the C code (with the initialize and finalize routines for the Ada DLL inside of the FOR loop), then the code sometimes bombs out.  When it bombs and when the program does not bomb is given next.

If the Ada procs invoked from the C code just do manipulations of variables (e.g., calculations), then the code will run fine.  However, if there is I/O in the Ada procs, then the code will bomb on the second time through.  It will bomb via an Ada.io_exceptions.status_error on line 169 of file s-fileio.adb.

It seems to me that if one invokes initialize and finalize, in pairs, each time through the loop, then the I/O should work; there should be no error.  That is, finalize should leave the code in a state such that the next initialize can indeed properly initialize the DLL.  Granted, one can just put the intialize and finalize at the beginning and end, respectively, of the C code.  However, when working with Java and JNI (composing a Java-C-Ada program), it is soemtimes most beneficial to issue initialize and finalize from the C code each time the C code (and the Ada DLL) is invoked from Java/JNI.  Furthermore, it is inconsistent to have the set of five (in this case) initialize and finalize invocations work for some Ada DLL uses and not for others.
>How-To-Repeat:
Please email me with your address and I'll email you the source files.  I have three small C source files, a few small Ada source code files, a batch file that compiles the Ada code and builds the DLL, the Ada definition file, and short instructions on how to modify the cmain25.c so that the code will and will not run correctly.
>Fix:
It seems to me that the fix is that Ada I/O should work with multiple initializations and finalizations of a single Ada DLL within one execution of a program (C the calling (main) source), as long as each initialization is accompanied by a finalization.

Thank you.
Chris Kuhlman 540-653-4721
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-01-01 18:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-07  0:46 ada/6946: problem with Ada DLL made with GNAT, invoked by C code Florian Weimer
  -- strict thread matches above, loose matches on Subject: below --
2003-01-01 18:41 neroden
2002-06-07  0:40 fw
2002-06-06  6:56 KUHLMANCJ

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