Board index » delphi » Using VCL in a DLL

Using VCL in a DLL

Hi,

As I understand I am allowed to use VCL in a DLL but before doing so I
must resolve some minor issues.
Can anyone number these issues for me, and if possible give me an
example? (eg. how to
overcome something about Application and problems that occur if
instanciated inside a DLL. etc.)

Thank you in advance.

 __
[Petros AMIRIDIS, BSc in Computer Science, HELLAS]

 

Re:Using VCL in a DLL


Here are some conditions that apply:

 1. the calling app can only use methods of the object that are
declared as virtual

  2. the object can only be created in the DLL.
  3. The object must be defined in both the DLL and in the application
with the methods in the same order.
  4. You cannot create descendants from the object in the DLL.

  There may be some other limitations.  If you get away from using a
DLL and use a package instead, this is a much better option.
 -- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Re:Using VCL in a DLL


Quote
"Xavier Pacheco (TeamB)" wrote:
> Here are some conditions that apply:

>  1. the calling app can only use methods of the object that are
> declared as virtual

>   2. the object can only be created in the DLL.
>   3. The object must be defined in both the DLL and in the application
> with the methods in the same order.
>   4. You cannot create descendants from the object in the DLL.

>   There may be some other limitations.  If you get away from using a
> DLL and use a package instead, this is a much better option.

Thank you for the answers ....
but I want the DLL to be called by a non-Delphi application. I don't need
the calling
application to use the VCL. I need the DLL to use the VCL or object
oriented programming in
general.
That is why I asked the first questions. I don't want objects to be
created or
used by the calling application. I just want to have the usual layer of
functions/procedures
that are exported, but inside the DLL I want to use the VCL. (i.e. cover
the functionality using
OOP, and not have everything inside the function that is exported,  ....
or/and have forms
that can be called via the calling application but used for the DLL only).
Let me draw it,
as a picture worths 1000 words:

------------------          --------------------
|a C++ program            | DLL
| just calls bla, bla1        |
|                                    | exports bla,
|                                    |            bla1...etc
|                                    |-----------------\/--
|                                    | VCL, forms etc. that are used
inside the DLL.
-------------------        ----------------------

Thank you,

 __
[Petros AMIRIDIS, BSc in Computer Science, HELLAS]

Re:Using VCL in a DLL


Petros,
  If I understand you correctly, sure, you can do this, you'll have to
pass the handle of the main application to the DLL functions and
assign it to the Application.Handle in the Dll so that your forms
display properly.  In this case, you're not really "exporting"
functions from classes but rather wrapping up their methods with DLL
function calls.  As long as you don't intend on using any visual
controls in the main application and so forth, you ought to be ok.

 -- x
==============================
Xavier Pacheco (TeamB)
xav...@xapware.com

Sorry but TeamB cannot answer support
questions received via email.

Other Threads