It’s impossible because C makes it impossible. Object references are just pointers to memory used to hold the object.
Suppose you were to create an object, delete it, and then make another object. The C allocator would notice the free memory and create the new object in that location. Thus, the same reference would be used for the new object.
The C approach is to keep track of when you delete the object and set all pointers referencing it to NULL. There is no better way of doing this in C that I know of - it’s a limitation of the language.
//inside function or callback
if (obj == ObjToCheckFor) {
ObjToCheckFor = NULL
}// and so on...
//and this outside the function when i want to check if its deleted or not, and run code depending on it
if (ObjToCheckFor != NULL) {
//run whatever here
}