0
votes

I have a dll (Created in Delphi) which includes a TGlobalForm inherited from TForm

I want to use the TGlobalForm in my project (Delphi Project) and inherit some forms from TGlobalForm.

Example TAccountsForm = class(TGlobalForm)

the problem is that I don't want to use the GlobalForm pas file in the Uses of the project and I want it to be like when you create a new form (File->New->Other) and you choose the (inheritable Items) under (Delphi Projects) Node so the new created form will show items (Buttons, Edits...) of the inherited form (TGlobalForm)

how to accomplish this?

I'm using Delphi XE3 - VCL Project

Thank you.

1

1 Answers

7
votes

It's not possible to import and use a VCL object from a DLL. When you try to do so you end up with two different instances of the VCL, including two different distinct versions of the imported form type. There's the version in the DLL, and the version in the application. They are distinct, and two versions of the type is one too many.

The supported way to import a complex type from another module is to use a package. If you don't want to use packages, then you'll have to use some form of interop that does work across DLL module boundaries. For example, COM interfaces.