comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Johnson <Mark_H_Johnson@Raytheon.com>
Subject: Re: can Ada be linked dynamically ??
Date: Thu, 10 Jan 2002 17:28:59 -0600
Date: 2002-01-10T17:28:59-06:00	[thread overview]
Message-ID: <3C3E23BB.F2CEA72@Raytheon.com> (raw)
In-Reply-To: 3C3DEB86.DB3214A2@champagnierle.de

Marc Neininger wrote:
> 
> > Yes, No, Maybe. It depends on which system you are using.
> I'm using LINUX with the normal gnat compiler
> 
> > You need to be a LOT more specific on which target system, which
> > compiler, and other relevant information before anyone can give you a
> > helpful reply. I also assume you really want to know "HOW" to do this,
> > not just can it be done.
> 
> ... Thanx for this fast answer. So generally spoken it is possible.
> Target systems would be Windows and Linux.
> 
> We are using typically gnat on Linux and Adagide on Windows (think it
> also works with the gnat compiler).

From the GNAT user's guide (assuming Linux)...

... For simple libraries, it is also possible to create a dummy main
program which depends upon all the packages that comprise the interface
of the library. This dummy main program can then be given to gnatmake,
in order to build all the necessary objects.

[dummy program not included]

gnatmake -c my_lib_dummy.adb
rm my_lib_dummy.o my_lib_dummy.ali
ar rc libmy_lib.a *.o
gcc -shared -o libmy_lib.so *.o

to generate both the static and dynamic library for the packages
referenced by "my_lib_dummy". I assume you know how to refer to a
separate library in linking.

In addition, to use the library, you need to provide the following
source files...
 - the specs of all packages that make up the visible part of the
library
 - all sources upon which the visible parts depend
 - the bodies of all visible generic units
For example, if you use pragma Inline for a function, you must provide
the body for that function. It is recommended (but not mandatory) to
include ALL source files used in the library - to aid the user in
debugging.

The user's guide has more details and other examples. I can't comment on
the same steps on Windows; perhaps someone else can.
  --Mark



  reply	other threads:[~2002-01-10 23:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-10 14:45 can Ada be linked dynamically ?? Marc Neininger
2002-01-10 15:27 ` Mark Johnson
2002-01-10 19:29   ` Marc Neininger
2002-01-10 23:28     ` Mark Johnson [this message]
2002-01-11  7:06       ` Marc Franz Neininger
2002-01-13 15:47         ` David Botton
replies disabled

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