comp.lang.ada
 help / color / mirror / Atom feed
From: "Ludovic Brenta" <ludovic.brenta@insalien.org>
Subject: Re: Shared Ada Library to be Used in a Non-Ada Context
Date: 11 Aug 2005 03:41:55 -0700
Date: 2005-08-11T03:41:55-07:00	[thread overview]
Message-ID: <1123756915.490493.33760@z14g2000cwz.googlegroups.com> (raw)
In-Reply-To: <1123747721.859778.146490@g43g2000cwa.googlegroups.com>

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




  reply	other threads:[~2005-08-11 10:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-08 23:35 Shared Ada Library to be Used in a Non-Ada Context David Sauvage
2005-08-09  2:50 ` Jeffrey Carter
2005-08-09 21:51   ` David Sauvage
2005-08-10  0:14     ` Georg Bauhaus
2005-08-10  7:53     ` Ludovic Brenta
2005-08-10 22:02       ` David Sauvage
2005-08-11  8:08         ` Ludovic Brenta
2005-08-11 10:41           ` Ludovic Brenta [this message]
2005-08-11 11:27             ` Georg Bauhaus
2005-08-11 23:26           ` David Sauvage
2005-08-10  7:38 ` Ludovic Brenta
replies disabled

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