comp.lang.ada
 help / color / mirror / Atom feed
* How to emulate multiple exports
@ 2020-04-19 23:53 Jere
  2020-04-20  6:27 ` Egil H H
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Jere @ 2020-04-19 23:53 UTC (permalink / raw)


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;

Each unused interrupt handler looks for a 
unique/specific external symbol name.

However, the Export aspect/pragma can only
be specified once for Default.  I've tried 
a few different solutions but all of them
are not really desirable.

1.  Tried doing renames of Default.  Doesn't
work as the compiler is smart enough to 
figure this out and complain that I have
multiple exports.

2.  Using a generic Default function and 
instantiating a separate copy for each unused
handler.  This lets me give each an export and
the code inside Default, but a separate copy
of Default is created for each handler causing
a severe loss of ROM space.

3.  Calling Default inside a wrapper procedure.
This is better than option #2, but still takes up
a lot of lost ROM space (multiple copies of the
wrapper function essentially).

In C and C++ I was able to leverage the 
alias attribute to do this, but I have been
unsuccessful in getting the analogous 
Linker_Alias pragma to work (it just ignores
Default altogether).

So is there any way to do this?  Or am I just
stuck with all the code bloat?

I'm working with the GNAT 2019 CE cross compiler
for ARM on Windows 10.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-04-24  1:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-19 23:53 How to emulate multiple exports Jere
2020-04-20  6:27 ` Egil H H
2020-04-20 20:48   ` Jere
2020-04-20  6:52 ` Jeffrey R. Carter
2020-04-20 20:51   ` Jere
2020-04-20  9:57 ` Simon Wright
2020-04-20 20:57   ` Jere
2020-04-21  7:58     ` Simon Wright
2020-04-24  1:36       ` Jere

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