Board index » delphi » Interface inheritence and TLB's

Interface inheritence and TLB's

Hello,

Theoretically,

I am trying to have a situation where a single client (perhaps with a client
object layer) can connect to multiple servers, deciding which one to connect
to, at run-time. Basically sometimes ClientA will connect to ServerA and
then sometimes to ServerB. ServerA and ServerB will be tottally different
but to ClientA they must look the same. The switch between ServerA and
ServerB will done done using a specific object layer within Client A.

Basically this should work if the interfaces are the same but - in order to
avoid mistakes in the interface specification I want to be able to 'inherit'
the base interface specification. I know I can do this, but after I have
done it, how do I expose it to a TLB?

So - to recap, I have a base interface specification (interfaceA), I want
this specification to be the base parent of both ServerA and ServerB's DCOM
interfaces, so I guess I cannot go and create these interfaces using the
TLB.

How is it then done?

Many thanks,

Carlos

 

Re:Interface inheritence and TLB's


If I understand correctly, this solves your problem:

Base.tlb: Contains IBase

Derived.tlb: Contains IDerived = interface (IBase)

To make IBase the parent of IDerived:

1) Register Base.tlb

2) In the Delphi TLE, edit Derived.tlb and click on the topmost node in the
left treeview. Then on the right pane, click Uses, then context menu (right
mouse click) to select "Show All Type Libraries". Then check Base.tlb from
the list.

3) Go back to the IDerived interface and note that you should be able to set
the Parent Interface field to IBase.

have fun
--
Binh Ly
http://www.techvanguards.com

"Carlos De Matos" <cdema...@manex-it.com> wrote in message
news:8mc9a5$7a56@bornews.borland.com...

Quote
> Hello,

> Theoretically,

> I am trying to have a situation where a single client (perhaps with a
client
> object layer) can connect to multiple servers, deciding which one to
connect
> to, at run-time. Basically sometimes ClientA will connect to ServerA and
> then sometimes to ServerB. ServerA and ServerB will be tottally different
> but to ClientA they must look the same. The switch between ServerA and
> ServerB will done done using a specific object layer within Client A.

> Basically this should work if the interfaces are the same but - in order
to
> avoid mistakes in the interface specification I want to be able to
'inherit'
> the base interface specification. I know I can do this, but after I have
> done it, how do I expose it to a TLB?

> So - to recap, I have a base interface specification (interfaceA), I want
> this specification to be the base parent of both ServerA and ServerB's
DCOM
> interfaces, so I guess I cannot go and create these interfaces using the
> TLB.

> How is it then done?

> Many thanks,

> Carlos

Other Threads