comp.lang.ada
 help / color / mirror / Atom feed
From: jeff.huter@bigfoot.com (Jeff)
Subject: Link C main with Ada static library
Date: 29 Nov 2002 00:45:53 -0800
Date: 2002-11-29T08:45:53+00:00	[thread overview]
Message-ID: <fe4bb2c2.0211290045.dba25a4@posting.google.com> (raw)

I've been trying to get a C main program to link to an Ada static
library using Gnat on Linux.  In order to simplify the task of
figuring out the correct process, I created a simple Ada static
library that exports a single function having no parameters and that
returns the integer "1".

I've been able to generate an Ada program which successful calls the
function of the static library.  But, I'm having no luck getting a
simple C main program to link to the Ada static library.  I hope the
below sheds some light. and that someone will provide a simple working
example or suggestions as to what i'm missing (I suspect 1 or more
switches). I have reveiwed the Gnat and Library section of  the Users
Manual.  But the manual doesn't show the process of linking the C main
to the Ada library.

$ gcc -ladazlib -L./ main.c
/tmp/cco0XQDo.o(.text+0x11): In function `main':
:undefined reference to `adazlibinit'
/tmp/cco0XQDo.o(.text+0x11): In function `main':
:undefined reference to `adaztest'
/tmp/cco0XQDo.o(.text+0x11): In function `main':
:undefined reference to `adazlibfinal'
collect2: ld returned 1 exit status

$ nm -s libadazlib.a

Archive index:
adazlibmain_E in b~adaztest.o
adazlibinit in b~adatest.o
adazlibfinal in b~adaztest.o
adazlib_E in adazlib.o
adaztest in adazlib.o
....

From the above nm output it appears that the symbols are in the Ada
library.



             reply	other threads:[~2002-11-29  8:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-29  8:45 Jeff [this message]
2002-11-29 10:04 ` Link C main with Ada static library sk
2002-11-29 22:27   ` Jeff
2002-11-29 23:25     ` sk
replies disabled

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