IDL 枚举未显示在类型库中

发布于 2024-07-05 15:39:13 字数 511 浏览 6 评论 0原文

我有一个使用 MS ATL 库编写的 COM 对象。 我已经在 IDL 中声明了一堆枚举,但是当使用 MS COM 对象查看器工具查看类型库时,它们没有出现。 问题似乎是缺少的枚举实际上并未被任何 COM 方法用作参数 - 我如何强制这些枚举出现?

例如,在 IDL 中:

// Used by Foo method, so appears in the type library
typedef enum FOO
{
    FOO_1,
    FOO_2,
} FOO;

// Not used by any method, so won't appear in the type library
typedef enum BAR
{
    BAR_1,
    BAR_2,
} BAR;

[id(1)] HRESULT Foo([in] FOO eFoo);

即使有问题的枚举没有被任何方法直接使用,它们对于使用该对象的任何人仍然有用,但我无法将它们导出。

有没有人见过这个?

I have a COM object written using the MS ATL library. I have declared a bunch of enumerations in the IDL but they do NOT appear when viewing the type library using the MS COM Object Viewer tool. The problem seems to be that the missing enums are not actually used as parameters by any of the COM methods - how can I force these enums to appear?

For example, in the IDL:

// Used by Foo method, so appears in the type library
typedef enum FOO
{
    FOO_1,
    FOO_2,
} FOO;

// Not used by any method, so won't appear in the type library
typedef enum BAR
{
    BAR_1,
    BAR_2,
} BAR;

[id(1)] HRESULT Foo([in] FOO eFoo);

Even though the enums in question aren't directly used by any methods, they will still be useful to anyone using the object, but I can't get them to export.

Has anyone seen this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌伤浅笑 2024-07-12 15:39:13

您是否将它们放入 IDL 的 library 部分? 只有library部分中提到的类型才会进入TLB。

library MyLib {
    // ...
    enum BAR;

Did you put them in the library section of the IDL? Only types mentioned in the library section go into the TLB.

library MyLib {
    // ...
    enum BAR;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文