Returning an interface from an automation object

Hi

I need to do something like the following

var
   data: IMyInterface;
   automationObject: IMyAutomationObj;
begin
   automationObject := CoMyAutomationObj.Create;
   data := automationObject.GetData;
end;

I have worked out how to create the automation controller, but what I
am unable to do is return an object from a function.  The function
needs to return an objects that implements an interface defined in my
type library.

I tried adding a new COM object to my project.  I unchecked the option
to add a type library and specified that it should implement my chosen
interface but all I achieved was to mess up my automation object and
now I cannot run it at all, even if I remove the extra COM object.

Would it work if I just add a normal unit to my project and create an
object descended from TInterfaced object that implements my interface.
 Then instantiate one of these in my automation object and returned
it.

Thanks for any help.

Alex