Hi Jerry, you could set a flag in the Ada front-end for plinit to indicate this has been called and check for the flag in the front-end for plend. Perhaps not the nicest of programming constructs, but it would prevent any problems that might arise if you can not call plend twice without an intervening plinit. By the looks of the code I do not think you should do that - the routine is freeing all manner of memory.
Regards, Arjen > -----Original Message----- > From: Jerry [mailto:lancebo...@qwest.net] > Sent: Tuesday, October 22, 2013 6:42 AM > To: PLplot development list > Subject: [Plplot-devel] How to treat calling plend in Ada > > A few weeks ago, at the time of the most recent PLplot release, I posted a > short > announcement on comp.lang.ada, and I gave a very simple example of usage in an > Ada program. Someone asked why plinit couldn't be done in the (Ada) > elaboration of > PLplot and why couldn't plend be done in the (Ada) finalization when the > program > terminates. These are Ada concepts meaning roughly that plinit could be > worked into > Ada's own initialization (aka elaboration, sort of) and finalization and thus > executed > automatically. I replied that in some usage situations PLplot needs to do > some work > before plinit is called. So that left the question of whether it made sense > to put plend > into an Ada finalization stage. I remarked that the manual method currently > used > would be better if the user wanted to free resources before the program was > done > running, but that it might be a good idea to have the automatic method (in > the Ada > finalization stage) in case the user forgot to do it manually. Then someone > pointed > out that if the program raises an exception, the manual method would be > bypassed. > We could ask the user to write an exception handler but s/he might forget to > do that > too. > > One might consider removing the manual method (and keeping backward > compatibility by making the Ada-level call do nothing) but I don't like > removing the > manual option for reasons stated above. > > So before trying to put in an automatic call to plend at the Ada > finalization, I need to > know: > > (1) Does it hurt to call plend twice without an intervening plinit? I.e., the > user puts in a > manual plend and Ada does another automatic plend. > > (2) If so, is there a way to find out if PLplot is "active," that is, has > there been a call to > plinit but no matching call to plend? > > Jerry > ------------------------------------------------------------------------------ > October Webinars: Code for Performance > Free Intel webinars can help you accelerate application performance. > Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from > the > latest Intel processors and coprocessors. See abstracts and register > > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk > _______________________________________________ > Plplot-devel mailing list > Plplot-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/plplot-devel DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited. The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail. ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel