comp.lang.ada
 help / color / mirror / Atom feed
* Strange error in mixed language program (incompatible libraries?)
@ 2004-08-09 18:37 James Alan Farrell
  2004-08-10  6:40 ` Simon Wright
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: James Alan Farrell @ 2004-08-09 18:37 UTC (permalink / raw)


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



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

end of thread, other threads:[~2004-08-14 15:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-09 18:37 Strange error in mixed language program (incompatible libraries?) James Alan Farrell
2004-08-10  6:40 ` Simon Wright
2004-08-10  7:04 ` Jerry van Dijk
2004-08-10 13:01   ` Marc A. Criley
2004-08-10 15:31 ` James Alan Farrell
2004-08-10 21:36   ` James Alan Farrell
2004-08-14 15:29   ` Simon Wright
2004-08-11  8:58 ` Pascal Obry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox