bpl delphi专家和dll delphi专家有哪些区别
我正在一名delphi IDE专家工作,现在为了避免依赖性问题,我正在考虑将这位专家重建为dll专家,正如其中之一所建议的答案,现在我的专家(编译为 bpl)访问 Screen
和 Application
全局变量(实例Delphi IDE 的),所以我想知道如果我将 Expert 编译为 DLL,我仍然可以访问这些变量,而且我想知道 BPL Delphi Expert 和 DLL Delphi Expert 之间的主要区别是什么?< /代码>
I am working in a delphi IDE expert , now to avoid dependencies problems, i was thinking in rebuild this expert as a dll expert as was suggested in one of these answers, now my expert (compiled as bpl) access the Screen
and Application
global variables (instances of the Delphi IDE), so i was wondering if i compile my expert as a dll i can still accesing these variables and also i want to know which are the main differences between a bpl delphi expert and a dll delphi expert?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
来自这个关于 OTA 的非常好的来源:GExperts
From this very good source about OTA: GExperts
当您访问全局变量时,这些全局变量对于 DLL 来说是全局的,而不是主 BDS.exe 的全局变量。我不确定,但我认为如果您在 Forms 中链接,您的 DLL 将拥有自己的 Screen 和 Application 全局变量以及 VCL 的核心。
那些属于 IDE 本身的东西可以通过 Open Tools Api (OTA) 访问。我相信您通常不会在专家的 IDE 之间共享任何对象,如果您尝试这样做,将会出现问题。您所做的任何绕过 OTA 的操作都将很容易以奇怪的方式受到破坏,尤其是在 IDE 的未来版本中。
依赖性问题当然是不使用基于 BPL 的包的一个重要原因,但我认为更大的原因是保持工具内部结构与 IDE 内部结构之间的完全分离。
请记住,DLL 目标与可执行目标一样,是静态链接的。这就是差异的核心。如果您的专家提供的功能仅使用合法的公开记录的 OTA 接口,那么迁移到 DLL 应该不会出现问题。如果您使用 BPL 可能的一些后门黑客攻击,那么我无法为您提供进一步的建议。
When you access a global variable those would be global variables that are global to your DLL, not global to the main BDS.exe. I am not sure but I think your DLL would have its own Screen and Application global variable, if you linked in Forms, and the core of the VCL.
Those things which belong to the IDE itself are accessed through the Open Tools Api (OTA). I believe that you do not normally share any objects between the IDE your expert anyways, and if you were to try to do so, it would be problematic. Anything at all that you do that bypasses the OTA is going to be vulnerable to breaking in strange ways, especially in future versions of the IDE.
Dependency problems are of course a big reason to not use BPL based packages, but I think an even bigger reason is to maintain a complete separation between your tool's internals, and the internals of the IDE.
Remember that a DLL target, like an executable target, is statically linked. That is the core of the difference. If your expert provides functionality that uses the legal public documented OTA interfaces only, then moving to a DLL should be problem free. If you use some back door hacks that are possible with BPLs, then I can't advise you further.