On Thu, 17 Aug 2006, Albert Zeyer wrote:
No, it will not. Reference counting with interfaces only works if you use interfaces as referencing types (so it has to be 'var MyObject: IUnknown'), all class-typed variables will not counted. I think this is because all class-typed variables are simply pointers and an interface variable is handled special (like a smart-pointer-structure in C++, which capsulate a pointer and does the reference counting automatically for you; this works, because a smart-pointer is constructed on the heap and so, it will automatically call the destructor if it goes out of scope). Is there a way to make a smart-pointer in pascal? Is it possible to create objects on the heap so that they will get destroyed and freed automatically when they get out of scope? Or is there a way to get informed if a class-typed variable get out of scope?
No. This has been discussed in the past, but no clean implementation could
be found, so the idea was dropped. Michael. _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives