Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Component From Dll (https://www.delphipraxis.net/113960-component-dll.html)

mohfa 17. Mai 2008 10:18


Component From Dll
 
Hi every One , i want to ask you about this Issue :
Is Possible to declare a Component Class in a Dll then Create or Use it in my Application ?
i mean :
Let's suppose i have in the Dll :

Var
MyLabel:TTntLabel;

so can i use this in my App like ?:

MyLabel.Create( Self );

without using the Unit (tntClasses or whatever tntxxx ) in my App uses clause .
just create the MyLabel in the App .


regards.

mkinzler 17. Mai 2008 10:23

Re: Component From Dll
 
No, in this case you could use a bpl

mohfa 17. Mai 2008 18:03

Re: Component From Dll
 
Zitat:

Zitat von mkinzler
No, in this case you could use a bpl

thank you mkinzler , but if i declare the unit Tntxxx in the Dll only , and create or use the TTntLabel in the App .

is this Possible ? .

or what do you suggest .

regards.

mkinzler 17. Mai 2008 18:08

Re: Component From Dll
 
It's not possible to use delphi classes in the interface of a dll.

Medium 17. Mai 2008 18:33

Re: Component From Dll
 
You might be able to let a DLL create an object and use in your host (named pipes, clipboard, WM_COPYDATA), and maybe even reroute the logic of a class to the DLL, but you will always need at least an empty prototype of that class declared in the namespace of your application to access methods and fields/properties. There might even be a way to write your own little "RTTI", with which you could do this for arbitrary structures, but as this term already indicates: This wouldn't have too much in common with objects/classes in the common sense.
Further more, to attempt this for already existing classes, you would have to essentially rewrite them, or at least modify them heavily. What will never work is, that you could install them as actual "components", so that you could move and edit these inside the Delphi IDE.

Maybe COM/ActiveX can take you there, but again, heavy modifications will probably be neccessary, and since I'm not too familiar with these, I don't know whether there are serious downsides while using them.

In any case, this will result in a more or less dirty hack :)

Jelly 18. Mai 2008 09:39

Re: Component From Dll
 
As mkinzler suggested... Use a BPL... It's intended for that.
Disadvantage: You can only the BPL in Delphi programs.

If you want to be flexible building DLLs and using them from different languages, so you might want to swap to the .NET framework.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:58 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz