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,d481d546f914128d,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit From: James Alan Farrell Newsgroups: comp.lang.ada Subject: Strange error in mixed language program (incompatible libraries?) Date: Mon, 09 Aug 2004 14:37:07 -0400 Message-ID: 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 1092076692 209.4.89.67 (9 Aug 2004 13:38:12 -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!peer01.cox.net!cox.net!newsfeed.slurp.net!not-for-mail Xref: g2news1.google.com comp.lang.ada:2637 Date: 2004-08-09T14:37:07-04:00 List-Id: Hello, all, I'm working on a program that is partly in C and partly in Ada. The main program is in C, and links to several libraries whose source is C, and one library whose source is Ada. When the C libraries are actually linked, I get an error raised STORAGE_ERROR : stack overflow (or erroneous memory access) This error is raised by one of the Ada routines BEFORE any of the C library routines are called. When the C library is not linked and the C calls are commented out the Ada routines run correctly. Unfortunately the program does not do anything this way. (Actually that's a good thing. The unfortunate thing is the specs say it HAS to so something ;) The Ada code is compiled with gnat version 3.15 The C code is compiled with gcc version 2.8.1 This shows how the Ada code is typically compiled, so you can see what flags, etc. we are using: gcc -c -Wall -g -gnatf -I/usr/local/lib/stk/include -DAPICALL= example.adb gnatmake -c example.adb -cargs -Wall -g -gnatf -I/usr/local/lib/stk/include -DAPICALL= where example.adb is a made up file name containing a package body with a set of functions to be loaded into the Ada library. There is a matching companion .ads file. The each library function is declared in the .ads file, and is accompanied with a pragma like pragma Export (C, My_Ada_Function_Name, "my_c_function_name"); The library is created with: ar rs libada_interface.a b~ada_interface.o ada_interface.o example.o ... (a dozen or so files) I've tried simple things like recompiling all Ada and C code, raising the stack limit then recompiling everything, etc. Anyone know what might cause this and how it might be fixed? Many thanks, James Alan Farrell GrammaTech.com