将.net dll导入Delphi 6丢失信息
我有一个 .net dll,可以导入到 Delphi 6。但它丢失了一些信息。
我在 VB.net 中有一个演示应用程序来使用这个 dll,它显示了 2 个名为 IRedeemTransactionItemBundle
和 ITransactionItemBundle
。在 Visual Studio 2008 中,我可以看到 ITransactionItemBundle
是 IRedeemTransactionItemBundle
的基本类型。因此,当我声明 IRedeemTransactionItemBundle 类型的变量时,我可以访问两个接口的所有属性。
但是当我将 dll 导入 Delphi 6 时,我可以看到 IRedeemTransactionItemBundle
和 ITransactionItemBundle
声明部分。但没有任何信息表明 ITransactionItemBundle
是 IRedeemTransactionItemBundle
的基本类型。另外,当我在 Delphi 中声明 IRedeemTransactionItemBundle
类型的变量时,我无法访问 ITransactionItemBundle
(基本类型)的属性。
当我尝试通过将 IRedeemTransactionItemBundle
的基本类型设置为 ITransactionItemBundle
来在 tlb 编辑器中注册库时,我收到错误:“父接口已具有 id 的成员: 1610743808”。我可以在 tlb 编辑器中看到两个接口的属性具有相同的 ID。
我也尝试使用 Delphi 7 导入相同的 dll。但没有帮助。
是德尔福的问题吗?有谁在导入时遇到过这样的问题请给我一些想法吗?
I have a .net dll which I could import to Delphi 6. But it loses some information.
I have a demo application in VB.net to use this dll which shows 2 interfaces calledIRedeemTransactionItemBundle
and ITransactionItemBundle
. In Visual Studio 2008 I could see that ITransactionItemBundle
is the base type of IRedeemTransactionItemBundle
. So when I declare a variable of type IRedeemTransactionItemBundle
, I could access all properties of both interfaces.
But when I import the dll to Delphi 6, I could see both IRedeemTransactionItemBundle
and ITransactionItemBundle
declaration part. But there is no information that shows ITransactionItemBundle
is the base type of IRedeemTransactionItemBundle
. Also when I declare a variable of type IRedeemTransactionItemBundle
in Delphi, I am not able to access properties of ITransactionItemBundle
(the base type).
When I tried to register the library in tlb editor by setting the base type of IRedeemTransactionItemBundle
to ITransactionItemBundle
, I am getting the error: “Parent Interface already has a member with id:1610743808”. I could see properties of both interfaces have same ID in the tlb editor.
I tried to import the same dll using Delphi 7 also. But no help.
Is that a problem with Delphi? Have any of you experienced such a problem in importing kindly give me some thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我建议您在 C# 或 VB.NET 中为 DLL 创建 COM 可见包装器,它将以 Delphi 可以正确交互的方式导入必要的功能。
I would suggest you to make COM visible wrapper for the DLL in C# or VB.NET which will import necessary functionality in the way Delphi can interact with correctly.
除了使用 COM 互操作之外,您还可以执行非托管导出。简而言之,您需要新的特定版本的 .net dll。
请前往这篇帖子了解使用 Delphi 的技术的详细信息。
Apart from using COM interop, you can do an unmanaged export. Simply put, you need a new specific version of the .net dll.
Please head to this post for details of the technique using Delphi.