开发者

C++ exposed property names don't match the names given in the IDL

开发者 https://www.devze.com 2023-01-23 20:22 出处:网络
In the IDL file for a C++ component I have something like the following, allowing the property to be COM visisble:

In the IDL file for a C++ component I have something like the following, allowing the property to be COM visisble:

interface IInterface
{
    [propget, id(1), helpstring("the ID")]
         HRESULT ID([out, retval] long *pVal);
}

When I build the dll and open in OLEView I see something like this!?

interface IInterface
{
    [propget, id(0x00000001), helpstring("the ID")]
         HRESULT id([out, retval] long *pVal);
}

Notice that ID is showing as id. However, if I modify this code, to say "ID2" t开发者_JS百科hen the ID2 is shown as expected. I then change back to "ID" and again id is shown. This is pretty baffling to me. There must be something on the machine which means the DLLs exposed name for this property is in lower case, but I can't find anything in the registry for this.

Any ideas? Very confused...


I'm guessing this relates to the fact that id has special meaning in IDL (as your own example shows) - if it's not essential for you to name your property using an IDL keyword, I would just use a different name.

If you must use this name for the property for some reason, you may be able to use it in the uppercase form using the rename attribute at import time.

0

精彩评论

暂无评论...
验证码 换一张
取 消