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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9a720a14a5d106b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "Ludovic Brenta" Newsgroups: comp.lang.ada Subject: Re: Shared Ada Library to be Used in a Non-Ada Context Date: 11 Aug 2005 03:41:55 -0700 Organization: http://groups.google.com Message-ID: <1123756915.490493.33760@z14g2000cwz.googlegroups.com> References: <1123660387.140929.305530@o13g2000cwo.googlegroups.com> <1123747721.859778.146490@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: 212.190.145.10 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1123756921 20772 127.0.0.1 (11 Aug 2005 10:42:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 11 Aug 2005 10:42:01 +0000 (UTC) In-Reply-To: <1123747721.859778.146490@g43g2000cwa.googlegroups.com> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=212.190.145.10; posting-account=ZjNXewwAAADyBPkwI57_UcX8yKfXWOss Xref: g2news1.google.com comp.lang.ada:4084 Date: 2005-08-11T03:41:55-07:00 List-Id: Here is a complete, working Makefile. gnatlink links libservices.so.0.0 against libgnat properly. When running main, you need to set LD_LIBRARY_PATH so that the dynamic linker finds libservices.so.0. libservices.so.0.0 contains the actual shared library. libservices.so.0 is needed when running main, because of the soname. libservices.so is needed when linking main, because of -lservices. This Makefile should work on any unix-like OS. HTH -- Ludovic Brenta. CC := gcc CFLAGS := -g -O2 ADAFLAGS := -g -O2 -gnatafno -gnatVa -fstack-check main: main.o libservices.so $(CC) -o $@ $< -L. -lservices libservices.so: $(wildcard libservices.ad[bs]) gnatmake -c $(ADAFLAGS) libservices.adb gnatbind -Lservices libservices.ali gnatlink -shared -o libservices.so.0.0 \ libservices.ali -Wl,-soname,libservices.so.0 ln -s libservices.so.0.0 libservices.so.0 ln -s libservices.so.0.0 libservices.so %.o: %.c $(CC) -c -o $@ $(CFLAGS) $< clean: -rm *.o *.ali b~* libservices.so* main .PHONY: clean