[fpc-devel] Safely shareable objects

Hans-Peter Diettrich DrDiettrich1 at aol.com
Fri Jul 1 14:47:47 CEST 2011


José Mejuto schrieb:

>>> IMyObject inherited from IShareable the compiler must add stub code on
>>> each function/procedure/property to lock the interface ?
> 
> HPD> No. The object is locked as long the code holds the reference to it.
> 
> In that case read my note at the end of the e-mail, I think it could
> not be done in that way.

Hmm, when the first reference is stored in a global variable, as was my 
intention, what happens to the refcount when a method is invoked 
immediately from that reference?

var ShareObj: ISomething;
...
ISomething.DoSomething;

Would a function (property getter...) help, that returns the reference, 
instead of a simple variable? I'm a bit clueless right now :-(

Thanks for the hint anyway :-)

DoDi




More information about the fpc-devel mailing list