If your code creates the thing, then just keep track of it to begin with. If your code didn’t create it, pass pointers around to it from code that did.
Do you have a more specific example of your question?
If your code creates the thing, then just keep track of it to begin with. If your code didn’t create it, pass pointers around to it from code that did.
Do you have a more specific example of your question?