comp.lang.ada
 help / color / mirror / Atom feed
From: Peter Brooks <peter.h.m.brooks@gmail.com>
Subject: Re: How to include shared code
Date: Wed, 18 Sep 2013 22:31:06 -0700 (PDT)
Date: 2013-09-18T22:31:06-07:00	[thread overview]
Message-ID: <f46333c1-5d51-4c67-b17c-bd152fe9331c@googlegroups.com> (raw)
In-Reply-To: <87zjr9u0ja.fsf@nl106-137-194.student.uu.se>

On Thursday, 19 September 2013 02:17:52 UTC+2, Emanuel Berg  wrote:
> 
> Now, how can I extract that piece of code from both files, and put
> it into another file, say, random_period.adb, and then "include"
> it into each of the above files (that operate in isolation)?
> 
That's what .ads files are for - you specify your function (and everything else you need shared) in a package in a .ads file. Then the gnat make will find and incorporate it:

http://blog.projectpolymath.org/ada-2012-tutorial_01/

gives an example of what a .ads file looks like at the bottom.

  reply	other threads:[~2013-09-19  5:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-19  0:17 How to include shared code Emanuel Berg
2013-09-19  5:31 ` Peter Brooks [this message]
2013-09-19  6:24   ` Simon Wright
2013-09-19  7:20 ` Dmitry A. Kazakov
replies disabled

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