[fpc-pascal] Re: Weird interface behavior

Michael Van Canneyt michael at freepascal.org
Sun Jan 23 17:31:44 CET 2011



On Sun, 23 Jan 2011, leledumbo wrote:

>
>> What's wrong with using an abstract class ?
>
> Nothing, that's just the way I got taught and I couldn't find a way to say
> it was wrong until today (I never used interface previously).
>
>> By choosing an interface, you implicitly get the reference counting on top
>> of things, and this seems to be what causes your error ?
>
> Yeah, I thought so. There's something different about Object Pascal's
> interface (I hope Delphi does the same) and Java (the one I learned in
> college).

You can force more 'Java Compatible' behaviour, I suspect, by choosing CORBA interfaces.

Please try adding

{$INTERFACES CORBA}

Before your interface declaration. It should then skip the reference counting.
So if the problem then goes away, you know that the ref. counting was the problem.

Michael.



More information about the fpc-pascal mailing list