Delphi and COM: Is it possible to pass TClientDataset to COM library as parameter?
No, you cannot pass such an object. This is not a valid COM interop type. In fact, you cannot even pass such an object between Delphi modules, other than runtime packages.
The most obvious solutions are:
- Wrap the object with a COM interface and pass it in. The interface will need to expose methods to retrieve the data.
- Serialize the data as JSON for example and pass it as text. On the other hand, you will need to de-serialize.
- Take advantage of the built-in serialization capabilities offered by the properties
The last two serialization based options are probably simpler. But more expensive in terms of memory. Using an interface requires more work to code, but can lead to more efficient runtime performance.
source to share