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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: How to emulate multiple exports Date: Mon, 20 Apr 2020 08:52:53 +0200 Organization: Also freenews.netfront.net; news.tornevall.net; news.eternal-september.org Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 20 Apr 2020 06:52:53 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="d15bfed0f1752a1a97cee877d94a6eae"; logging-data="31808"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18eUadoTQUtQiVHVP8k0OZt98zq/jpNIHk=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 Cancel-Lock: sha1:/MoIQnzOPuDlbF9k7MxTSEKRUK4= In-Reply-To: Content-Language: en-US Xref: reader01.eternal-september.org comp.lang.ada:58426 Date: 2020-04-20T08:52:53+02:00 List-Id: On 4/20/20 1:53 AM, Jere wrote: > I am working in a space constrained environment (256k flash) > and I want to try and reuse the same exported function for > all of my unused interrupt handlers. > > procedure Default; > procedure Default is > begin > -- Do some complex stuff; > end Default; Interrupt handling in Ada is defined in ARM C.3 (http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-C-3.html). The standard way to use a single handler for multiple interrupts is to create the handler as a library-level parameterless protected procedure with aspect Interrupt_Handler set to True. At elaboration, calls to Ada.Interrupts.Attach_Handler attach this handler to multiple Interrupt_Ids. No Export is needed. GNAT is supposed to support Annex C for all targets, so I would expect this to work with your setup. Perhaps there is something about your target that prevents this approach, but this would be my initial approach to the problem. -- Jeff Carter "He that hath no beard is less than a man." Much Ado About Nothing 132