# Interface types "namespacing" in Delphi?

**URL:** https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027
**Category:** Remoting SDK
**Created:** [September 22, 2014, 3:24pm UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027 "2014-09-22T15:24:27Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Anachronox](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@Anachronox](https://talk.remobjects.com/u/Anachronox)
#### Post date: [September 22, 2014, 3:24pm UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027/1 "2014-09-22T15:24:27Z")

</div>

Hello.

I’ve one actual problem.

I need to use more Interfaces (\_Intf) in my client project, with same types.

For example, I have LibraryA\_Intf and LibraryB\_Intf included in my project.

And both of them declare my own “RTResponse” type, but it differs in both RODLs.

The problem is that both types are registered with the same class name in the Initialization section in both units by RegisterROClass.

They have same name, but GetClass doesn’t violate and registers both of them (but this is not the point).

When I need to invoke some service, the types are mish-mashed in runtime and doesn’t match with the current type definition (in terms of scope).

Is there some way to let co-exist more RO-Interfaces with some types with the same class name ?

Is there some solution to “namespace” types in the Initialization section ?

Thank you for your help.

---

<div class="post-metadata">

### Author: ![mh](https://talk.remobjects.com/user_avatar/talk.remobjects.com/mh/32/18050_2.png) [@mh](https://talk.remobjects.com/u/mh)
#### Post date: [September 22, 2014, 3:47pm UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027/2 "2014-09-22T15:47:36Z")

</div>

I’m afraid there’s no way to support this, currently. RemObjects SDK uses a flat namespace for all types on the wire, as not all platforms supported by RO have namespace support. You will need to pick unique names.

---

<div class="post-metadata">

### Author: ![Anachronox](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/67e7ee/32.png) [@Anachronox](https://talk.remobjects.com/u/Anachronox)
#### Post date: [September 22, 2014, 4:10pm UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027/3 "2014-09-22T16:10:03Z")

</div>

OK, Roger Marc.

---

<div class="post-metadata">

### Author: ![jensw\_2000](https://talk.remobjects.com/user_avatar/talk.remobjects.com/jensw_2000/32/159_2.png) [@jensw\_2000](https://talk.remobjects.com/u/jensw_2000)
#### Post date: [September 22, 2014, 6:44pm UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027/4 "2014-09-22T18:44:47Z")

</div>

In such cases I used a 3rd RODL that defines RTResponse as base type.  
The both other RODLs can inherit it’s customizes Response Types from the central RODL. Thats worked fine in my use cases.

---

<div class="post-metadata">

### Author: ![gschoch](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/g/ebca7d/32.png) [@gschoch](https://talk.remobjects.com/u/gschoch)
#### Post date: [March 30, 2015, 11:34am UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027/5 "2015-03-30T11:34:06Z")

</div>

I struggled today over the same problem. In my case I have to support 2 versions of an API provided by [Salesforce.com](http://Salesforce.com) (Enterprise\_V29 and Enterprise\_V33 WSDL)

The same object names with small differences exists within both versions. And they both have to exist in the same application. For the moment I have to dynamically RegisterROClass and UnRegisterROClass to work around that issue.  
But this cannot be a final solution.

The problem is the fact that 2 identically named Classes exist.  
lActualClass := FindROClass(clsnme);  
returns the wrong one and fails in  
if not lActualClass.InheritsFrom(aClass) then RaiseError…

Why not give FindROClass(clsname,aClass) … as a hint to the preferred class if more than object with that name exists?

---

<div class="post-metadata">

### Author: ![gschoch](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/g/ebca7d/32.png) [@gschoch](https://talk.remobjects.com/u/gschoch)
#### Post date: [March 31, 2015, 9:09am UTC](https://talk.remobjects.com/t/interface-types-namespacing-in-delphi/5027/6 "2015-03-31T09:09:39Z")

</div>

I made some more tests and the whole is not that easy.

Switching to find an ROClass by QualifiedClassName (=[unitname]\_[classname]) instead of ClassName does not work at all places. Why: At certain generic code areas the [unitname] not known.

But the problem remains that this is a major design problem. Really world use cases cannot be solved with the current implementation of RO SDK.

Why is it that complex to improve? Why not register the objects be referencing to the interface class name  
procedure RegisterROClass(aComplexTypeClass : TROComplexTypeClass; aROInterfaceClassName: string);

regards Günther
