Question: I am programming a DLL. I have to return an instance of TBitmap to the host application.
The DLL has another UNIT, wich is a Form, that it has a TImageList for storing images. I wrote a function that I want to return an Image from the TImageList (from the DLL to the host application. How can I do this?

Thanks,
Yulién.

Answer: 
Read this old thread on borland.public.delphi.nativeapi: [Delphi Object in DLL - does this work?](http://groups.google.com/group/borland.public.delphi.nativeapi/browse_frm/thread/9dd5708d25ac5544/).

The link to a .pdf in the last message is gone, but thanks to Internet Archive Wayback Machine one can [download it](http://web.archive.org/web/%2A/safariexamples.informit.com/0672321157/Ebooks/D5DG/chapter9.pdf) (look at *Exporting Objects from DLLs* at page 412).

**Edit:** it turns out that book's interesting part, for our purpose, is also available @ Google Books, so [one can read it on-line](http://books.google.com/books?id=HWo0H6GYuqYC&pg=PT316).
You can't return an object per se, but you can return a pointer to an object. Refer to [Mastering Delphi 6](http://books.google.com/books?id=YbS3dPcobl8C&pg=PA836&lpg=PA836&dq=delphi+vmt+dll&source=bl&ots=wmWQbhn8p7&sig=bfSB6Y22UrUyw4ZtcG3S9r4sQrg&hl=en&ei=oizeSrGUDYTQtgPZuLyIDg&sa=X&oi=book_result&ct=result&resnum=5&ved=0CBcQ6AEwBA#v=onepage&q=delphi%20vmt%20dll&f=false) and this [description of Vtables in delphi](http://pages.cs.wisc.edu/~rkennedy/vmt).