1 year ago
#326570
ROBERT RICHARDSON
#import changing the name of an imported function
I've been spending way too much time on this problem.
I am developing a project that uses COM in the Visual Studio 2019 Enterprise edition. I have the following interface defined in my IDL file:
// IIOLinkBusMdlExt [ object, uuid(1E0C9381-E5F6-4C39-8660-C64A519FDC51), dual, nonextensible, helpstring("IIOLinkBusMdlExt Interface"), pointer_default(unique) ] interface IIOLinkBusMdlExt : IDispatch { [propget, id(1), helpstring("ChannelMode getter")] HRESULT ChannelMode( [in] unsigned short ChannelNumber, [out, retval] enum IOLinkChannelMode* pChannelMode );
[propput, id(1), helpstring("ChannelMode setter")]
HRESULT ChannelMode(
[in] unsigned short ChannelNumber,
[in] enum IOLinkChannelMode ChannelMode
);
[propget, id(2), helpstring("method GetChannelModeString")]
HRESULT ChannelModeString(
[in] unsigned short ChannelNumber,
[out, retval] BSTR* pModeString
);
[id(3), helpstring("method Initialize")]
HRESULT Initialize(
[in] SAFEARRAY(IOLinkChannelMode)
);
};
Note that the I in "Initialize" is capitalized.
But the .tlh file contains this:
struct __declspec(uuid("1e0c9381-e5f6-4c39-8660-c64a519fdc51"))
IIOLinkBusMdlExt : IDispatch
{
//
// Raw methods provided by interface
//
virtual HRESULT __stdcall get_ChannelMode (
/*[in]*/ unsigned short ChannelNumber,
/*[out,retval]*/ enum IOLinkChannelMode * pChannelMode ) = 0;
virtual HRESULT __stdcall put_ChannelMode (
/*[in]*/ unsigned short ChannelNumber,
/*[in]*/ enum IOLinkChannelMode pChannelMode ) = 0;
virtual HRESULT __stdcall get_ChannelModeString (
/*[in]*/ unsigned short ChannelNumber,
/*[out,retval]*/ BSTR * pModeString ) = 0;
virtual HRESULT __stdcall initialize (
/*[in]*/ SAFEARRAY * __MIDL__IIOLinkBusMdlExt0000 ) = 0;
};
Now the i in initialize is lower case!
I verified that the .tlh file is getting rebuilt when the IDL changes by removing the declaration of Initialize() from the IDL and then looking at the .tlh file. The method was not there. Then I put the Initialize() declaration, spelled correctly, back into the IDL, rebuilt, and the method reappeared, spelled incorrectly, in the .tlh file.
What is happening?
com
midl
0 Answers
Your Answer