Re: How to link an ADA and C library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Rau,

For reference i should state that gnatmake is a nice program about
figuring out how to compile ada code and keeping track of all
the files used in a product (including not just the .o, but also
the linking information .ali).  I realize that you know this, but
i think it should be stated for context.  And also, when i first
started programming in ada 12 years ago i made a gigantic
mistake by not using the ada infrastructure but rather relying
on my own makefiles.  (Maybe my biggest single mistake on
that job, certainly one of the top two.)

Having said all that, if you don't use gnatmake, then you still have
to learn everything it knows.  That is, you have to be able to compile
specs, know something about elaboration order (gnatmake may
well generate additional code that has to be compiled so that
the linking exists, etc).  [I no longer have easy access to an
ada compiler so unfortunately i cannot do a sensible check
on this.]

So, even though you're not going to use gnatmake for your
project, it might still be a good idea to throw together a few
ada files---file1.ads, file1.adb, file2.ads, file2.adb, my_prog.adb---
with some dependencies among them---and then gnatmake my_prog.
Do it verbosely and track all the intermediate products you get.

Then you can probably figure out what you need to do.

dan

PS: hope i don't sound like a nagging relative!!!!!  but i have made
lots of mistakes on this very path. :(

And anybody please correct me, because i don't want to be too
much of a old dang fool.

On Wed, Jul 29, 2009 at 2:54 PM, Rau<antalost@xxxxxxxx> wrote:
>
> Hello,
>
> the error I obtain is "'undefined reference to __gnat_eh_personality'" and I
> obtain it once the .a is formed using, first the ada library and later the c
> library including the ada library.  The final link, with the main program
> finds the problem.
>
> It seems like an internal reference created during the compilation was not
> correctly added to the .a, so the final link is impossible.
>
> I know the way of doing everything is not the most accurate, I mean to Ada
> to get a library and then build a new library in C with an Ada library
> embedded, but it is the exact structure I need.
>
> Thanks
>
>
> Amittai Aviram wrote:
>>
>> On Jul 29, 2009, at 4:51 AM, Rau wrote:
>>
>>>
>>> Hello, I want to compile a project consisting on an Ada body file
>>> (and its
>>> specification), an C body file (and its specification) and a C file
>>> with the
>>> main entry to the program.
>>>
>>> [...]
>>
>>> Maybe am I missing a flag when binding the Ada code ...
>>>
>>> Can somebody help me ...
>>>
>>> Thanks.
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-link-an-ADA-and-C-library-tp24715044p24715044.html
>>
>>
>> What kind of error messages are you getting?
>>
>> Amittai Aviram
>> Graduate Student in Computer Science
>> Yale University
>> 646 483 2639
>> amittai.aviram@xxxxxxxx
>> http://www.amittai.com
>>
>>
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-link-an-ADA-and-C-library-tp24715044p24728793.html
> Sent from the gcc - Help mailing list archive at Nabble.com.
>
>


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux