Hi Nicola,

Quote Originally Posted by {MSX}
Hi! I'm tring to use CORBA interfaces (that are interface that doesn't derive from IUnknown).
You don't have to derive your class from IUnknown in Delphi or Kylix either, and just to clarify, as far as I am aware, they are not known as CORBA interfaces, they are just known as interfaces, while the Win32 variety are known as COM interfaces.

Quote Originally Posted by {MSX}
I'd like to just have an "interface" layer for my classes, i don't want the ref count stuff.
As mentioned you can also do this in Delphi/Kylix.

Quote Originally Posted by {MSX}
One problem i had is that the interfaces can't be freed by themselves..
I don't think this is a Pascal specific problem, it is just that Java and C# have garbage collectors that go round freeing the stuff for you when they go out of scope. Also since there is no such concept as an IObject base class for all interfaces, that would explain why there is no Free method.

In Delphi, and I assume FreePascal, if you want to reset the interface you would need to assign nil to it.

[pascal]
var
n : INamed;
begin
n := TNamedItem.create;
n.GetName;
n := nil;
end;
[/pascal]

Without reference counting how will it know when to clean itself up?

IMHO, use interfaces, but use them for defining a cleaner object hierachy, but when it comes to your application/game use instances of the class instead.

for example:
[pascal]
type
IHuman = interface
function GetName:string;
end;

IMale = interface( IHuman )
function GetName:string;
function MaleChromosome:string;
end;

IFemale = interface( IHuman )
function GetName:string;
function FemaleChromosome:string;
end;

TChild = class( TObject, IMale, IFemale )
function GetName:string;
function MaleChromosome:string;
function FemaleChromosome:string;
end;

var
Kid : TChild ;
begin
Kid := TChild.Create;
try
Kid.GetName;
Kid.MaleChromosome;
Kid.FemaleChromosome;
finally
Kid.Free;
end;
end;
[/pascal]

Anyway, just my 2 kubits worth.