From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec31fb6eda682268 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: James Alan Farrell Newsgroups: comp.lang.ada Subject: Re: STORAGE_ERROR in adainit Date: Thu, 12 Aug 2004 09:35:32 -0400 Message-ID: References: <2nvktgF5530iU1@uni-berlin.de> X-Newsreader: Forte Free Agent 2.0/32.652 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: fw.grammatech.com X-Trace: newsfeed.slurp.net 1092317796 209.4.89.67 (12 Aug 2004 08:36:36 -0500) X-Original-NNTP-Posting-Host: 209.4.89.67 Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!diablo.voicenet.com!209.242.86.15.MISMATCH!newsfeed.slurp.net!not-for-mail Xref: g2news1.google.com comp.lang.ada:2690 Date: 2004-08-12T09:35:32-04:00 List-Id: Marc, Thanks for the reply We've already tried the steps you suggest. The program now is quite small - simply the call to adainit and to one C library function. The complexity (at least at this time) is in building the libraries. Thus creating a "toy" program will be little better than creating the program we have now. We cannot call any other Ada procedures until Adainit completes successfully. A C main that simply calls Adainit works fine. A C main that calls Adainit then only functions in the Ada library works fine. We only have problems when we start pulling in the C libraries. We have experimented with calling different C library functions and found that some cause the problem and others do not, depending on what C library the function is in. We found that none of the libraries that do *not* call to other libraries show this problem. Some of those that do make such calls show the problem and others do not. I do not know if one C library calling another C library is relevant. It is our understanding that when a call is made to a library, that causes the object file in which the function resides to be linked in. We traced one occurance of the problem to a call in C library to an error function that uses fprintf and exit. Looking at the included object file (actually the C source), it is a set of error routines, each of which calls fprintf then exit and nothing else. So we pulled the call to the error function out of the library and replaced it with direct calls to fprintf and exit. Adainit completed correctly. So pulling in the object file that makes calls to these functions and only these functions causes the problem, but making direct calls to these functions without pulling in that object file does not. The file with the error routines are not in the same library as the function calling them. This suggests to me that I need to create a small simple C lib with one object file in it, then a second simple C lib that calls the first. Then a C main that calls Adainit then a function in the second lib. I'll report back later today on the results of that experiment. Don't know if this will make things clearer to anyone else -- their "as clear as mud" to me. Thanks again to anyone who can shed further light on this problem. James On Wed, 11 Aug 2004 17:29:01 -0500, "Marc A. Criley" wrote: >"James Alan Farrell" wrote: > >> I have a mixed language program with the main function written in C. >> There are several libraries written C and one written in Ada. The >> first command in main is adainit, and that function is raising the >> following error: >> >> raised STORAGE_ERROR : stack overflow (or erroneous memory access) > >Can you write a toy program with a C main that calls into Ada? Like building >one of the example programs. Just to make sure there's no environmental >issue that's causing interference. > >Then how about a C main that just calls adainit? > >Do you get a storage error on adainit when calling just one of the library >functions? If not, which function triggers the problem and in what library >does it reside? > >This is the kind of stuff I'd try to try to starting localizing the >problem... > >> Is there anything special I have to do to create C libraries when >> linking to Ada libraries? > >No, just plain old compilation of them should work fine. >