From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.236.147.18 with SMTP id s18mr13410171yhj.28.1379568666898; Wed, 18 Sep 2013 22:31:06 -0700 (PDT) X-Received: by 10.49.62.97 with SMTP id x1mr249068qer.10.1379568666658; Wed, 18 Sep 2013 22:31:06 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!d5no459065qap.0!news-out.google.com!gv3ni591qab.0!nntp.google.com!d5no459063qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 18 Sep 2013 22:31:06 -0700 (PDT) In-Reply-To: <87zjr9u0ja.fsf@nl106-137-194.student.uu.se> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=105.236.80.243; posting-account=p-xPhAkAAADjHQWEO7sFME2XBdF1P_2H NNTP-Posting-Host: 105.236.80.243 References: <87zjr9u0ja.fsf@nl106-137-194.student.uu.se> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: How to include shared code From: Peter Brooks Injection-Date: Thu, 19 Sep 2013 05:31:06 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:17202 Date: 2013-09-18T22:31:06-07:00 List-Id: 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.