I have tried to run c-style function exec()
(with some suffix) in a C++ code, but mentioned that no destructors were invoked for existing objects.
Is there a way to guarantee the invokation of all required destructors - like on the program termination - before the exec()
?
May be, there is another way to achieve the substitution of executing code without exec()
in C++?
From the man page
The exec() functions only returns if an error has occurred.
Since the exec function overlays the process with a new image, there is no way that you can perform any destructors after a successull call.
If you need to clean up, then you should do it before exec is called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With