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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9a720a14a5d106b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!newsfeed1.swip.net!swipnet!nntpserver.swip.net!not-for-mail From: David Sauvage User-Agent: Mozilla/5.0 (X11; U; Linux i686; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Shared Ada Library to be Used in a Non-Ada Context References: <1123660387.140929.305530@o13g2000cwo.googlegroups.com> In-Reply-To: <1123660387.140929.305530@o13g2000cwo.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Message-ID: NNTP-Posting-Host: 83.179.5.44 X-Complaints-To: news-abuse@swip.net X-Trace: nntpserver.swip.net 1123711192 83.179.5.44 (Wed, 10 Aug 2005 23:59:52 MET DST) NNTP-Posting-Date: Wed, 10 Aug 2005 23:59:52 MET DST Organization: A Customer of Tele2 X-Sender: -@d83-179-5-44.cust.tele2.fr Date: Thu, 11 Aug 2005 00:02:06 +0200 Xref: g2news1.google.com comp.lang.ada:4076 Date: 2005-08-11T00:02:06+02:00 List-Id: Ludovic Brenta wrote: > You should use the system C compiler (gcc-3.3) and the system Ada > compiler (gnat). I suggest you remove gnat-3.4 and reinstall gnat. > This will make your toolchain consistent with all other Ada > packages in Sarge. >... Hi, thanks a lot for your tips ! i removed gnat-3.4, install gnat and update the Makefile [2] i replaced "$(CC) $(CFLAGS) -c b~libservices.adb" by "gnatgcc $(CFLAGS) -c b~libservices.adb" as the first line give me "gcc: installation problem, cannot exec `gnat1': Aucun fichier ou r�pertoire de ce type" > Your Makefile should link libservices.so to libgnat explicitly. Well i don't thing i figure out how to link libservices.so to the libgnat the good way, but it work now. I had "-L/usr/lib/gcc-lib/i486-linux/2.8.1/adalib/ -lgnat" at the end of the library creation line, i'll keep searching. After setting the LD_LIBRARY_PATH, it works !! On the GNAT UG "Creating an Ada Library to be Used in a Non-Ada Context" [1], i read about installing the library so that it is not necessary to invoke the library elaboration and finalization routines, interesting ... ;-) [1] http://gcc.gnu.org/onlinedocs/gcc-3.3.5/gnat_ug_unx/Creating-an-Ada-Library-to-be-Used-in-a-Non_002dAda-Context.html [2] Makefile OBJS = libservices.so main CC = gcc CFLAGS = -g -fPIC -Wall all : $(OBJS) libservices.so : libservices.adb libservices.ads gnatmake -c libservices.adb gnatbind -Lservices libservices gnatgcc -g -fPIC -c b~libservices.adb $(CC) $(CFLAGS) -shared -Wl,-soname,libservices.so.0 -o libservices.so.0.0 b~libservices.o libservices.o -L/usr/lib/gcc-lib/i486-linux/2.8.1/adalib/ -lgnat main : libservices.so main.c $(CC) $(CFLAGS) -o main main.c -L. -lservices clean : rm -f *.o *.ali b~* *~ -- David