How to return an instance from a DLL?

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

Thanks, YuliΓ©n.

+4
object dll winapi delphi
source share
4 answers

Read this old thread at borland.public.delphi.nativeapi: Delphi Object in a DLL - does it work? .

The link to .pdf in the last message has disappeared, but thanks to the Internet Way Way Machine you can download it (see Exporting Objects from DLLs on page 412).

Edit: It turns out that the interesting part of the book for our purpose is also available @Google Books, so you can read it online .

+4
source share

Basically, you need not to return an object. In this case, you want to return the bitmap, why not just return the HBitmap?

+2
source share

Objects are combinations of code and data. A regular DLL does not support this because it only supports the C binary application interface (C ABI), but there are DLLs that do: BPL files. In other words, you need to create a .bpl file, not a .dll file. This requires both this file and the user to be Delphi, of course.

0
source share

You cannot return an object as such, but you can return a pointer to an object. See Mastering Delphi 6 and this Vtables description in delphi .

-3
source share

All Articles