Call procedure on End
Posted: Sun Apr 17, 2011 11:07 pm
Hey,
Would be nice to see a feature implemented where the programmer can 'register' a procedure that automatically gets called when the application ends.
I know it could just be added at the bottom of the source code, but in instances where 'End' is called, or the console is closed etc, it wouldn't apply.
For example, I use a piece of hardware that acts as a kind of relay board, controlled by a DLL, connected by USB.. If I don't explicitly uninitialize the library, it causes a crash, and with it being a console program, a program closure can happen at any time, so having a function that will be called without fail ensures I can correctly release the library, thus preventing unwanted effects.
Obviously the functionality of this feature can be applied to all kinds of situations.
Would be nice to see a feature implemented where the programmer can 'register' a procedure that automatically gets called when the application ends.
I know it could just be added at the bottom of the source code, but in instances where 'End' is called, or the console is closed etc, it wouldn't apply.
For example, I use a piece of hardware that acts as a kind of relay board, controlled by a DLL, connected by USB.. If I don't explicitly uninitialize the library, it causes a crash, and with it being a console program, a program closure can happen at any time, so having a function that will be called without fail ensures I can correctly release the library, thus preventing unwanted effects.
Obviously the functionality of this feature can be applied to all kinds of situations.