comp.lang.ada
 help / color / mirror / Atom feed
From: Michael Card <thehouseofcards@remove.this.part.mac.com>
Subject: Re: Building a minimal-source-code Ada library with GNAT
Date: Sat, 09 Mar 2002 02:24:52 GMT
Date: 2002-03-09T02:24:52+00:00	[thread overview]
Message-ID: <080320022124260513%thehouseofcards@remove.this.part.mac.com> (raw)
In-Reply-To: mailman.1015573982.10301.comp.lang.ada@ada.eu.org

Chris-

Thanks for the suggestions. The use of -I vs -A didn't change anything
for me, but I did figure out how to do this. 

As it turns out, the crucial step I was missing was that my .o and .ali
files had to be created as the resulting of LINKING one or more
applications that used the top-level packages. So, the steps I followed
were:

1. I ran gnatmake a few times to build several applications, so that as
a result all of the top-level packages would be used (i.e. all of the
top-level public generics would be instantiated), i.e.

gnatmake -g -gnatE my_application -I /path_to_my_app_source
-I/path_to_lib1_source -I/path_to_lib2_source -largs -lsocket -lnsl

gnatmake -g -gnatE my_application_2 -I /path_to_my_app_source
-I/path_to_lib1_source -I/path_to_lib2_source -largs -lsocket -lnsl

2. Next, I created subdirectories to hold the .o files and the .ali
files that would be put into the Ada libraries

3. I moved the .o and .ali files into their respective subdirectories.
I did as you suggested and did a chmod 444 to make the .ali files
read-only.

4. I created an object archive of all of the .o files in the library
subdirectories using ar, then deleted the .o files. The archives had
the usual naming convention, i.e. lib<Adalib_name>.a

5. I used cp -p to copy the necessary .ads and .adb files into the
library subdirectories, leaving out the source code that was not needed
for compilation that I wanted to "hide" from users of the libraries

6. After doing these things, I cleaned (rm *.*) the directory where I
initially build the applications, and I was able to build and run them
successfully using my new GNAT Ada libraries like this:

gnatmake -g -gnatE my_application -I /path_to_my_app_source
-I/path_to_Adalib_1 -I/path_to_Adalib_2 -L/path_to_Adalib_1
-L/path_to_Adalib_2 -largs -lsocket -lnsl -lAdalib1_name -lAdalib2_name

- Mike

In article <mailman.1015573982.10301.comp.lang.ada@ada.eu.org>,
Christoph Grein <christoph.grein@eurocopter.com> wrote:

> > and still got this error. For the gnatmake, I used the -A<path to Ada
> > library> option to point to these Ada libraries, as it looked like this
> > was what I should use. For example:
> > 
> > gnatmake -g -gnatE my_application -A/path_to_library
> > -A/path_to_library_2 -largs -lsocket -lnsl
> 
> See the "Search Paths and the Run-Time Library (RTL)" section in Gnat UG. The
> correct 
> switch is -Idir. Also make the ALI files read only.



  reply	other threads:[~2002-03-09  2:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-08  7:52 Building a minimal-source-code Ada library with GNAT Christoph Grein
2002-03-09  2:24 ` Michael Card [this message]
2002-03-09 15:45   ` Wes Groleau
2002-03-10  2:28     ` Michael Card
  -- strict thread matches above, loose matches on Subject: below --
2002-03-08  5:45 Michael Card
replies disabled

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