Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MIDL changes case of identifier when compiling IDL file

Tags:

midl

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;
    };
};

...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).

If I call my coclass XirtualMachine, for example, it's all good.

What the hell?

like image 643
Roger Lipscombe Avatar asked Aug 14 '09 14:08

Roger Lipscombe


1 Answers

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.

See the KB220137

like image 109
Sam Avatar answered Oct 18 '22 03:10

Sam