IDL枚举未显示在类型库中

时间:2022-09-19 16:05:12

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?

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

For example, in the IDL:

例如,在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?

谁看过这个吗?

1 个解决方案

#1


14  

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

你把它们放在IDL的库部分吗?只有库部分中提到的类型才会进入TLB。

library MyLib {
    // ...
    enum BAR;

#1


14  

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

你把它们放在IDL的库部分吗?只有库部分中提到的类型才会进入TLB。

library MyLib {
    // ...
    enum BAR;