comp.lang.ada
 help / color / mirror / Atom feed
From: David Sauvage <pariakaman@gmail.com>
Subject: Re: Shared Ada Library to be Used in a Non-Ada Context
Date: Thu, 11 Aug 2005 00:02:06 +0200
Date: 2005-08-11T00:02:06+02:00	[thread overview]
Message-ID: <sNuKe.23668$hV3.8565@nntpserver.swip.net> (raw)
In-Reply-To: <1123660387.140929.305530@o13g2000cwo.googlegroups.com>

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



  reply	other threads:[~2005-08-10 22:02 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 [this message]
2005-08-11  8:08         ` Ludovic Brenta
2005-08-11 10:41           ` Ludovic Brenta
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