> On 03/31/11 15:00, Kjell Rilbe wrote: >> Generally speaking, I feel it's completely wrong to add something to >> an api only because some clients/users would expect it, unless it >> actually does something useful in the api. it will only lead to extra >> complexity and problems down the line. >> >> So, if the only reason to add queryInterface is to make Delphi users' >> life easier I'd say no, even if I've been a huge Delphi fan ever since >> version 1. > > BTW, what's a problem with writing using Delphi code RAII type for our > interface without built-in into compiler support?
It is not a *big* problem, no. But it will be very convenient. See simplified example below : 1. Not compatible with IUnknown. a) Our public header class Interface { virtual int _cdecl addRef() = 0; virtual int _cdecl release() = 0; }; class IFoo : public Interface { virtual void _cdecl xxx() = 0; }; b) Delphi declarations type IFBInterface = class function addRef : Integer; abstract; cdecl; function release : Integer; abstract; cdecl; end; IFoo = class(IFBInterface) procedure xxx; abstract; cdecl; end; TFBInterface = class(TInterfacedObject, IFBInterface) private: // IInterface overloads function _AddRef : Integer; function _Release : Integer; // IFBInterface methods function addRef : Integer; function release : Integer; FFBIntf : IFBInterface; public: constructor Create(AFBIntf : IFBInterface); end; TFoo = class (TFBInterface, IFoo) private: FFoo : IFoo; public constructor Create(AFoo : IFoo); // IFoo methods procedure xxx; end; function TFBInterface._AddRef : Integer; begin return addRef; end; function TFBInterface._Release : Integer; begin return release; end; function TFBInterface.addRef : Integer; begin return FFBIntf.addRef; end; function TFBInterface.release : Integer; begin return FFBIntf.release; end; c) Delphi code example : var aFoo : IFoo; begin aFoo := TFoo.Create( fbGetMeFoo; ) aFoo.xxx; end 2. If we became compatible with IUnknown a) Our public header class Interface { virtual int _stdcall queryInterface(...) = 0; virtual int _stdcall addRef() = 0; virtual int _stdcall release() = 0; }; class IFoo : public Interface { virtual void _stdcall xxx() = 0; }; b) Delphi declarations IFoo = interface (IInterface) procedure xxx; stdcall; end; c) Delphi code example : var aFoo : IFoo; begin aFoo := fbGetMeFoo; aFoo.xxx; end Regards, Vlad ------------------------------------------------------------------------------ Create and publish websites with WebMatrix Use the most popular FREE web apps or write code yourself; WebMatrix provides all the features you need to develop and publish your website. http://p.sf.net/sfu/ms-webmatrix-sf Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel