From: Adriano d. S. F. <adr...@gm...> - 2011-03-30 19:13:06
|
On 30-03-2011 14:40, Vlad Khorsun wrote: >> On 30-03-2011 08:04, Vlad Khorsun wrote: >>> >>> With Delphi you will just use IAttachment, without SmartPtr, as Delphi's "interface" have >>> built-in compiler magic to work with reference counts. >>> >> AFAIK, this is not how it works. >> >> Delphi "interface" has nothing directly related with refcount. >> >> Refcount comes on when IInterface is used, but IInterface is about COM >> (has queryInterface). I don't think you can make our interfaces to work >> with IInterface, so you won't get RAII with Delphi and our interfaces. > > Therefore it will be very desirable to add queryInterface to the our base interface, > even empty or raising notImplemented error. IUnknown *is* industry standard, despite > of our wish to accept it. > > Simple Delphi wrappers could be written to deal with reference counters but > i prefer to add queryInterface to the our interfaces. > No, it's not desirable to add bogus method to our interface. We also use different calling convention than COM, otherwise our versioning system don't work. Also: - Interfaces are something completely unknown for most Delphi developers. It's used only for interact with COM and somethings like shell objects (also COM) in the Windows API. It's completely unused in Delphi visual components AFAIK. - It's sad that (if) Delphi creators still don't put in the language a way to support RAII decently. - We're create an API that almost no Delphi user will use directly. It's probably even many years to component creators starts using it. So it's okay to let them explicitly call a method to release an object, like they need to destroy any other object, cause they language don't support RAII. Adriano |