Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-08

exitproc?

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

waldo kitty

back in the [g]?olden days of TP6, i used to be able to set an exitproc procedure that would be executed any time my program exited for any reason... something like

   exitproc := @myexitproc;

is this still able to be done easily? does it work even if there's an untrapped exception?

NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted.
Tomas Hajny
to waldo kitty
waldo kitty wrote 11 lines
back in the [g]?olden days of TP6, i used to be able to set an exitproc procedure that would be executed any time my program exited for any reason... something like exitproc := @myexitproc; is this still able to be done easily? does it work even if there's an untrapped exception?

Yes.

Yes, as long as the exception is handled (caught) by the RTL.

Tomas

leledumbo
to waldo kitty: back in the [g]?olden days of TP6, i used to be able to set an exitproc procedure that…
is this still able to be done easily?

No difference I guess:
http://www.freepascal.org/docs-html/rtl/system/exitproc.html However, this is better:
http://www.freepascal.org/docs-html/rtl/system/addexitproc.html

does it work even if there's an untrapped exception?

Just try it

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/exitproc-tp5719871p5719877.html Sent from the Free Pascal - General mailing list .
waldo kitty
to Tomas Hajny: Yes. Yes, as long as the exception is handled (caught) by the RTL. Tomas
Tomas Hajny wrote 16 lines
On Tue, August 5, 2014 02:00, waldo kitty wrote: > > back in the [g]?olden days of TP6, i used to be able to set an exitproc > procedure that would be executed any time my program exited for any > reason... > something like > > exitproc := @myexitproc; > > is this still able to be done easily? does it work even if there's an > untrapped > exception? Yes. Yes, as long as the exception is handled (caught) by the RTL.

do you mean that it cannot be a "unhandled exception" with ''crash'' and heaptrace dumping the thousands of left-behind memory blocks that weren't deallocated?? that's what i'm trying to get past... i want to see the error and unhandled exceptions but i really want to properly deallocate the 40000+ * 5 records on the heap instead of having to either wait for heaptrace to finish dumping them or forcibly closing the task or (in the worst cases) rebooting the entire machine...

this is a console app based on tapplication (mainly for parameter parsing capability) and i have no clue (yet) how to catch exceptions and deal with them properly...

additionally, this last time i had to deal with this, fpc 2.6.4 release for OS/2 was dieing with "unknown error 110" (IIRC) during runtime... i finally determined this to be from trying to reset a file that didn't exist where the path was pointing to... goofy error on my part that i fixed by fsplitting the pattern and adding the directory portion back to the initial directory path being used... in any case, i thought i should also mention this so that it can be corrected so it is not ""unknown"" any more ;)

NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted.
waldo kitty
to leledumbo: No difference I guess: http://www.freepascal.org/docs-html/rtl/system/exitproc.html…
leledumbo wrote 6 lines
> is this still able to be done easily? No difference I guess: http://www.freepascal.org/docs-html/rtl/system/exitproc.html However, this is better: http://www.freepascal.org/docs-html/rtl/system/addexitproc.html

thanks for the pointers! i was extremely tired when i wrote my original post... 16 hours editing (reformatting) a wikipedia table and researching the hundreds of entries in it can really make one's eyes cross :/

> does it work even if there's an untrapped exception? Just try it

i will try... hopefully i won't have to do anything to execute my existing procedures and i'll be able to stop manually executing them in my code as they should be executed automatically by using this method...

NOTE: No off-list assistance is given without prior approval. Please *keep mailing list traffic on the list* unless private contact is specifically requested and granted.