MIDL在编译IDL文件时更改标识符的大小写 [英] MIDL changes case of identifier when compiling IDL file
问题描述
我有一个IDL片段,如下所示:
I've got a snippet of IDL that looks like this:
[ object, uuid(...), pointer_default(unique) ]
interface IVirtualMachine { /* ... */ }
[ object, uuid(...), pointer_default(unique) ]
interface IVirtualServer : IUnknown
{
HRESULT FindVirtualMachine(
[in] BSTR configurationName,
[out,retval] IVirtualMachine **virtualMachine);
};
[ uuid(...), version(1.0) ]
library VirtualServerLib
{
[ uuid(...) ]
coclass VirtualServer
{
[default] interface IVirtualServer;
};
[ uuid(...) ]
coclass VirtualMachine
{
[default] interface IVirtualMachine;
};
};
...当我使用MIDL进行编译,然后查看生成的类型库时,VirtualMachine
(大写V)变成了virtualMachine
(小写V).
...when I compile it with MIDL and then look in the generated type library, VirtualMachine
(upper-case V) has been turned into virtualMachine
(lower-case V).
例如,如果我将我的同班同学称为XirtualMachine
,那一切都很好.
If I call my coclass XirtualMachine
, for example, it's all good.
什么鬼?
推荐答案
这是MIDL的错误/功能.它不允许相同的标识符以不同的大小写形式出现,因此从第一次看到该单词起,它将所有后续的单词实例都替换为大写字母.
This is a terrible bug/feature of MIDL. It doesn't allow the same identifier to appear with different casing, so it replaces all subsequent instances of a word with the casing from the first time it was seen.
请参见 KB220137
这篇关于MIDL在编译IDL文件时更改标识符的大小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!