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!reader02.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!io.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Plugin-based code Date: Mon, 4 Jun 2018 17:08:30 -0500 Organization: JSA Research & Innovation Message-ID: References: <564cec8c-8da9-4e59-a687-5408fd3a429f@googlegroups.com> Injection-Date: Mon, 4 Jun 2018 22:08:31 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="23076"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader02.eternal-september.org comp.lang.ada:52935 Date: 2018-06-04T17:08:30-05:00 List-Id: "mockturtle" wrote in message news:564cec8c-8da9-4e59-a687-5408fd3a429f@googlegroups.com... ... >In order to have all the built-in plugins registered in my executable, I >need to >"with" them, so that they are linked to my code and the initialization part >of >their bodies is elaborated. However, no part of my code call explicitly, >say, >SVG_Plotter. Therefore, my solution is to add something like > > with Plotters.SVG; > pragma Warnings(Off, Plotter.SVG); > >in the "main." It works, but it leaves me a bit unsatisfied since it seems >an "hack". Definitely. >Also, since no actual code is called directly I am not sure if the binder >could >take the liberty of not including them (maybe it cannot, but I am not >sure). If the code could be called indirectly (via dispatching, say) it should remain in any case (at least in a correct compilation system!). Otherwise, it could get removed. (Janus/Ada does this automatically - it reduces the size of Claw programs from 2.5 MB to 0.5 MB; GNAT does not to such removal, to my knowledge - there's some tool you could use to do it.) I'd expect from your program structure that you are registering routines to be called via dispatching calls. That should work properly, just with a "with", even with no direct calls. I used a similar structure in the Claw builder for registering the supported entities (buttons, edit boxes, dialogs, main windows, etc.), and didn't have any problems. (Well, I needed one giant case statement to emulate a factory, 'cause Ada didn't have anything like that at the time. So the constructor for each type is called explicitly. But all of the other operations are called only by dispatching.) Randy. Do you have any better solution? Also, I am not sure if I risk getting in trouble with Elaboration order. I think not, but I am not 100% sure. What do you think? Thanks, Riccardo