The use of such interfaces ensures that an object that implements the interface is created and freed in the same heap.
However, this will not solve the problem of distributing dynamic row types and releasing them on different heaps. There are many possible solutions for this, but, in my opinion, the best approach is to use WideString along the border of the module.
The WideString type is a wrapper around COM BSTR and is distributed on a common COM heap. You just need to use WideString for the interface. The interiors of implementing classes can use their own Delphi strings.
Just as strings represent problems, so are dynamic arrays. Attempting pas dynamic arrays across module boundaries is unsafe. There is no solution similar to WideString, which is convenient. You can use array options, but it's pretty awkward compared to WideString.
source share