Original Post
I''m looking into adding a debug version reference counter into my programs. I want to have a simple routine that I can drop into any of my apps and still continue to use new/delete as normal, but output info to a log in the case of reference counting anomolies.
I figure the best method would be to add a small function call to the constructor of the abstract base class from which all my other classes extend. The reference counting part is dead easy, but to assist me in tracking down the source of the error, I want to be able to record the cpp filename of each created object. The problem is, if the reference function is in the base object, then any __FILE__ macros will equate to the base object''s file, not the file of the new subclassed object.
So is there any way in which I can get the function to obtain the filename of the new object being created without having to add a function call to every object''s constructor?
I''m using VC6.