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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,16656275b5169989,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-29 00:45:54 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: jeff.huter@bigfoot.com (Jeff) Newsgroups: comp.lang.ada Subject: Link C main with Ada static library Date: 29 Nov 2002 00:45:53 -0800 Organization: http://groups.google.com/ Message-ID: NNTP-Posting-Host: 68.98.54.41 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1038559553 29266 127.0.0.1 (29 Nov 2002 08:45:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 29 Nov 2002 08:45:53 GMT Xref: archiver1.google.com comp.lang.ada:31308 Date: 2002-11-29T08:45:53+00:00 List-Id: 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.