问题标签 [idl]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2818 浏览

atl - 从外部类型库导入 IDL 中的接口

我有两个使用 ATL 和 Microsoft 的 IDL 编写的带有 COM 接口的类型库。我希望一个库中的接口从另一个库中的接口继承。

本质上,我想做 Steven 在如何使用 .tlb 类型在 VS C++ 中创建接口方法?. 唯一回答他的人似乎不明白这个问题。

这是我想做的,在代码中:


SomeLibrary DLL/TLB

ISomeInterface.idl

SomeLibrary.idl


SomeOtherLibrary DLL/TLB

ISomeOtherInterface.idl

SomeOtherLibrary.idl


MIDLimport指令仅在导入 IDL 文件时有效,而我只有一个 DLL 和 TLB。我不能使用importlib,因为这只适用于library定义。MIDL 编译器不理解 Microsoft 的 C++ importimportidlimportlib属性。

该怎么办?

0 投票
1 回答
639 浏览

visual-studio - 防止重新编译 oaidl.idl 和 ocidl.idl

我有一个带有许多 IDL 文件的 COM/ATL 项目。大多数这些 IDL 文件importoaidl.idl 和 ocidl.idl。

每当我编译我的项目时,Visual Studio每次遇到import 时都会调用 MIDL 来重新编译 oaidl.idl 和 ocidl.idl ...。这两个 IDL 文件最终会被重新编译多次,从而使项目编译需要很长时间!

有没有办法强制 Visual Studio 只编译一次 oaidl.idl 和 ocidl.idl?

0 投票
1 回答
4754 浏览

c# - 你如何将 IDL 翻译成 C#?

例如,DOM 规范有各种IDL 定义接口节点就是其中之一。您将如何将其(甚至其中的一部分)翻译成实际的 C#?我的意思是,你甚至会从哪里开始?据我了解,C# 的接口的行为与 IDL 在这里调用的接口大不相同。我错了吗?

0 投票
2 回答
1847 浏览

visual-studio-2008 - ATL project created using wizard does not compile due to unresolved symbols

I have been working on getting a basic ATL project to compile in Visual Studio 2008 and I keep running into errors. Ultimately I have gotten stuck with the following build errors:

What am I overlooking or doing wrong? Here are the steps to reproduce.

  1. Create a new ATL Project named SomeProject. Accept all defaults.
  2. Right-click the project in the Solution Explorer and select Add > Class.
  3. Select ATL Simple Object and enter SomeObject as its Short Name. Accept all other defaults.

At this points the project builds fine. However I want to split my IDL among multiple files for better organization (my IDL would be thousands of lines long).

  1. Right-click the project and select Add > New Item.
  2. Select Midl File and enter ISomeObject as its filename.
  3. Open SomeProject.idl and cut the ISomeObject interface declaration. Replace it with import "ISomeObject.idl";.
  4. Paste the interface declaration in ISomeObject.idl.

In order to satisfy Microsoft's IDL compiler we need to change some options:

  1. Right-click the project and open its Properties. Go to the MIDL > Output section and enter the following values:
    • Header File: $(InputName).h
    • IID File: $(InputName)_i.cpp
    • Proxy File: $(InputName)_p.cpp
    • Generate Type Library: No
  2. Go to the C/C++ > Precompiled Headers section and set Create/Use Precompiled Header to Not using Precompiled Header. There are errors later if precompiled headers are used.
  3. Select the SomeProject.idl file so that its properties are displayed. Go to the MIDL > Output section and set Generate Type Library to Yes.
  4. Remove SomeProject_i.h and SomeProject_i.c from the Generated Files filter.
  5. Add the following Existing Items to the Generated Files filter. You may need to attempt to compile the project first.
    • SomeProject.h
    • SomeProject_i.cpp
    • ISomeObject.h
    • ISomeObject_i.cpp

Now, at this point I would expect the project to compile. But it doesn't. You should get the LNK1120 errors that I listed at the top of this question.

Any ideas? Am I overlooking something simple?

0 投票
1 回答
7653 浏览

atl - oaidl.idl 和 ocidl.idl 有什么用?

默认的 ATL 简单对象在其 IDL 文件的顶部具有以下内容:

这些文件有什么用,我怎么知道什么时候需要导入它们?是否有任何文档描述了这两个文件中定义的内容?我不知道“oa”和“oc”代表什么,文件本身也没有有用的注释。

0 投票
1 回答
3640 浏览

com - 使用 Midl 从 .idl 创建 .tlb 的问题“期望类型规范”

我一直在与被称为 COM Interop 的野兽长期相遇……

我目前正在尝试从由 OLE/COM 对象查看器生成的 .idl 文件生成 .tlb。然而,当试图运行 Midl.exe 来编译它时,我得到一个错误:

我的 .idl 文件超过 1000 行,所以我不想在这里发布它,但我相信感兴趣的部分是:

然后几行之后......

我有一种感觉,应该尊重这些以修复类型规范错误。但是,如果我这样做,我会遇到一个新问题。

我对 idl 格式和 midl.exe 的使用非常不熟悉,也许我正在做的事情有什么明显的错误?

一如既往,任何帮助将不胜感激:)

0 投票
1 回答
726 浏览

build-process - 使用 automake/Makefile.am 生成 IDL 实体

对于那些不熟悉 IDL(接口描述语言)的人来说,它抽象了数据描述以供跨平台(java、c、c++ 等)使用。我的项目具有从 Foo.idl 生成的依赖项 Foo.c、Foo.h、FooHelper.c 和 FooHelper.h。如何在 Foo.idl 更改时运行任意命令,但在构建过程中仍包含 Foo.c、FooHelper.c?

我目前的尝试向 Makefile.am 添加了一条规则——希望将规则复制到生成的 Makefile 中。

我努力了:

然后将 Foo.idl 添加到 my_program_SOURCES 但它在构建时不运行 the_generate_command。

我已经成功地从 IDL 生成

但它不会将 Foo.c、FooHelper.c 添加到编译过程中,因此它们永远不会被构建,只是由 the_generate_command 生成!

所有代码(包括 idl)都在 $PROJECT_DIR/src 中。

0 投票
1 回答
732 浏览

delphi - 在 ridl 中包含文件

我正在处理的 Delphi 项目要求我创建一个非常大的类型库以添加 COM 支持。问题在于 Delphi 中的类型库/ridl 编辑器很难管理(从程序员的角度来看)如此大的文件,我想将它沿功能线拆分。我遇到的问题是我看不到将一个 ridl 文件包含在另一个文件中的方法。我知道 importlib 函数,但我也找不到在同一个项目中创建多个类型库的方法,或者从 delphi 中创建一个 tlb 文件。谁能给我一些关于如何更好地管理这个的想法?

0 投票
3 回答
1721 浏览

com - 将两个 .IDL 文件或两个 .tlb 文件合并为一个文件

我有 2 个 .net dll,我使用 REGASM 向 COM 公开。为了简化 COM 客户端中的引用,我想将它们合并到一个文件中。

我尝试将这两个文件都转换为 IDL,然后将其中一个文件的库部分的内容复制到另一个文件中,然后使用 MIDL 编译回 .tlb。这适用于第二个 IDL 中的 TypeDef,但是当涉及到我复制的接口时,它似乎失败了。OLE/COM 查看器可以看到接口定义,但是当我尝试通过 COM 使用 TLB 时,它找不到接口我复制进去了。

在我花太多时间在这之前,我想确保实际上可以通过这种方式来减少 IDL。

0 投票
2 回答
820 浏览

interface - CORBA:CORBA IDL 类型可以是另一个属性吗?

在我开始使用 CORBA 之前,我想知道一些事情。

在我看来,您可以使用 IDL 类型作为另一个类型的属性,这对我来说似乎很直观,然后也会将该属性的方法公开给客户端应用程序(使用“.”)。

但这可能吗?

例如(请原谅我糟糕的 IDL):

然后在客户端应用程序中,您可以执行以下操作:myCar.brakePedal.press();

如果你不能做这些多层次的对象接口,CORBA 会显得很糟糕。毕竟,现实世界的对象是多层次的,对吧?那么有人可以让我放心并确认(或尝试,如果您已经设置了 CORBA)这是否确实有效?IDL 文档都没有在示例中明确显示这一点,这就是我担心的原因。谢谢!