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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,88e7ef9008757431 X-Google-Attributes: gid103376,public From: Francois Godme Subject: Re: Function Calls by Address Date: 1999/09/05 Message-ID: <37D2E1A7.CAC3F923@magic.fr>#1/1 X-Deja-AN: 521441661 Content-Transfer-Encoding: 7bit References: <37CADE68.6AF06F5D@escmail.orl.lmco.com> <37CEEFFA.7D73F78D@magic.fr> <7qooh7$hbh$1@nnrp1.deja.com> <37CFFEA6.921CBE59@magic.fr> <7qp5oo$2un@hobbes.crc.com> <7qptoa$cul$1@nnrp1.deja.com> X-Client: Magic On Line [unknown@ppp-209.net2.magic.fr] X-Accept-Language: fr Content-Type: text/plain; charset=us-ascii Organization: very little Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-09-05T00:00:00+00:00 List-Id: Robert Dewar wrote: > In article <7qp5oo$2un@hobbes.crc.com>, > "David C. Hoos, Sr." wrote: > > As far as separates go.. it's frequently wise to use separates > for target- > > dependent code. I also use them to keep down the size of > package body > > files -- e.g., for procedures that have long case constructs, > or whatever. > > This is indeed a useful application. Have a look at the files > ??emstop.adb in the GNAT sources as an example ... > > Sent via Deja.com http://www.deja.com/ > Share what you know. Learn what you don't. Yes, back in the Ada83 days, this was a good use (you were almost forced) but now, you can do it in better ways. One way would be to define an abstract tagged type that abstracts what you want to do and to implement several concrete subclasses of this abstraction, one for each target. Only the main subprogram will know on which target it is running and will pass down to the application the appropriate instance or the appropriate factory to build instances. With pragma Linker_Options carefully set, by "with"ing units from the main to select the factories, you define, at the same time, the link command. This does not apply to compiler builders.