delphi exe and dll without build with runtime packages

前端 未结 1 560
一生所求
一生所求 2021-01-07 12:57

For my last project i was using many frames in my delphi application ,so i dicided to create dlls and put them inside the dlls(ALL created in Delphi)

i have gone thr

相关标签:
1条回答
  • 2021-01-07 13:31

    Too bad. That code won't work without run-time packages. (And with run-time packages, you should use LoadPackage instead of LoadLibrary.)

    Without packages, each module of your program (the EXE and each DLL) has its own copy of the definition of all the standard classes, including TFrame, TWinControl, and even TObject. A TWinControl class from the EXE doesn't look like a TWinControl to the DLL.

    Since you're sharing classes between modules, you need to make sure they all have the same definitions of those classes, and run-time packages is how you do that.

    If you really won't use run-time packages, then you need to change the interface of your DLL so it doesn't share any Delphi object types. Instead of the TWinControl parent, pass the control's Handle property, or any other HWnd value to serve as the parent window. The DLL code will not be able to assume that there is a Delphi object for the parent anymore, and the EXE will not be able to assume that the control it receives is a Delphi object; they will be restricted to using the Windows API to manipulate window handles and send messages.

    0 讨论(0)
提交回复
热议问题