如何将IDL导入Delphi? [英] How to import IDL into Delphi?

查看:130
本文介绍了如何将IDL导入Delphi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将接口定义语言(idl)文件导入Delphi;将类型和接口转换为Pascal文件?

How do i import an Interface Definition Language (idl) file into Delphi; converting the types and interfaces to a pascal file?

我尝试过:

  • 文件打开:它仅显示.idl文本文件的文本
  • 项目添加到项目:它只是(行为类似)向项目添加了.idl文本文件
  • 组件安装组件导入类型库添加:但这会导致崩溃的处理
  • 组件安装组件导入ActiveX控件添加:但这会导致处理崩溃 li>
  • 使用Embarcadero的 GenTLB 工具:失败(这很有意义,

  • File, Open: it just shows the text of the .idl text file
  • Project, Add to project: It just (acts like) it adds a .idl text file to the project
  • Component, Install component, Import a Type Library, Add: But it causes a handled crash
  • Component, Install component, Import ActiveX Control, Add: But it causes a handled crash
  • using Embarcadero's GenTLB tool: Fails (which makes sense, as GenTLB it doesn't support IDL, only "RIDL"):

D:\>gentlb d:\develop\avatar\pdb\source\import\CorSym.idl
Embarcadero GenTLB Version 12.16581
Copyright(c) 1995-2010 Embarcadero Technologies, Inc.

Opening  'd:\develop\avatar\pdb\source\import\CorSym.idl'
***ERRORS*** - 3 errors encountered:
Error E0001 CorSym.idl 14: 'library' expected, found 'cpp_quote' instead
Error E0001 CorSym.idl 49: Type keyword expected, found 'const' instead
Error E0001 CorSym.idl 63: '<EOF>' expected, found 'module' instead

  • DocWiki - Type Libraries
  • How can I import a IDL file to DELPHI Project? (2005)
  • How to Import IDL to a project (2006)
  • Delphi 2010: how to convert .idl files to .TLB files? (2009)
  • IDL to Type Library (2011)

推荐答案

您可以通过Embarcadero工具使用两阶段流程:

You can use a two stage process with Embarcadero tools:

  1. 使用gentlb从您的IDL文件创建类型库.
  2. 使用tlibimp从类型库创建Pascal导入文件.
  1. Use gentlb to create a type library from your IDL file.
  2. Use tlibimp to create a Pascal import file from the type library.

我个人使用gentlb从Embarcadero IDE生成的.ridl文件中创建类型库.我相信.ridl是IDL的Embarcadero风格,与标准MS IDL不兼容.如果您拥有MS风格的IDL,则可以使用MS IDL编译器生成类型库.

I personally use gentlb to make a type library from an Embarcadero IDE generated .ridl file. I believe that .ridl is an Embarcadero flavour of IDL that is not compatible with standard MS IDL. If you have IDL of the MS flavour then you'd use the MS IDL compiler to generate the type library.

这篇关于如何将IDL导入Delphi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆