Came by a curious case today, that got me thinking about how the object model in delphi really works.
The case:
We have imported a SOAP service that expose a couple of methods, taking objects as parameters. Delphi generates classes/interfaces that we use to communicate with the soap service, and the objects used as parameters all inherit from TRemotable.
For different reasons, we have put all the communication with the soap service into a dll.
We then tried to instantiate the objects that should be sent in the main executable, and pass it over to the library for serialization and sending.
Now, that did not work, but gave an exception that I did not expect.
It said that the object we where trying to send to the soap service, must inherit from TRemotable, but it does. By inspecting the object, we can see that the class is the imported class from the wsdl, and that the parent class is indeed TRemotable.
Building with packages solves this issue.
The question:
Is it so that a class defined in a source file, shared between two libraries, ends up as different classes at runtime? If so, why is that?
As far as I know, it should be ok to pass objects between libraries. How, then, is strong typing ensured, and to what extent will object instances be compatible to each other?