Monitoring start and close of a process?

Is there a way to track processes in Mac OS X until they start and end?

I have a dynamic that I would like to add to several selected processes before starting so that you can bind. And I would like to do the opposite when the application shuts down, that is, when the application shuts down, I want to unload this library from this process and, thus, unhook it.

What could be the best solution for my situation?

+1
source share
2 answers

When the application shuts down, it automatically unloads this library from this process. I had an error that prevented the call of the destructor from dylib.

0
source

At Carbon, you can register for an event kEventClassApplication/kEventAppLaunched. For failure, I think that searching for an event may not be the best approach; You won’t be able to respond on time before the process really ends. It might be better if the entered code sets up a handler atexitor something like that.

+1
source

All Articles