[fpc-pascal] corba interfaces - is/as not working properly
David Emerson
dle3ab at angelbase.com
Wed Sep 28 23:59:36 CEST 2016
On 09/28/2016 01:24 AM, Graeme Geldenhuys wrote:
> On 2016-09-28 08:38, David Emerson wrote:
>> I'm testing out CORBA interfaces before changing all my code to use them
>> (I would prefer not to have managed types for interfaces).
>
> I've been using CORBA style interfaces for years, and it was always
> worked well for me. I must add, I never use the is/as syntax though (for
> COM or CORBA style interfaces). I always use Supports(..) as in:
>
> var
> h: i_hello;
> begin
> // fellow is the class instance variable.
> if Supports(fellow, i_hello, h) then
> h.hello;
>
>
> The Supports(..) syntax just seems more logical to me than the is/as
> syntax. The latter assumes the object "is" an instance of one of the
> interfaces and simply typecasts it to a interface variable. The
> Supports(..) syntax queries the object instance and asks if it supports
> a specific interface.
Thanks, Graeme. I tried this but I'm getting a compilation error:
"Interface type i_hello has no valid GUID"
I assume this is the Supports function(s) in sysutils
Is it possible to use Supports / QueryInterface / GetInterface /
something else, without having a GUID?
Alternately, if I give a GUID does an interface not automatically become
COM + managed?
Thanks,
David
More information about the fpc-pascal
mailing list