ATL's auto IDL generating is adding A/W to my methods!
-
It's common to see FunctionA and FunctionW for ANSI/UNICODE versions, however my ATL functions are being created like this which is not good. For example, I made a method called OpenService which returns an IService object (of my creation) and takes as a parameter a BSTR. So the declaration is as follows:
__interface IConfigurer : IDispatch { [id(1), helpstring("method Open")] HRESULT Open([in] BSTR machineName); [id(2), helpstring("method Close")] HRESULT Close(void); [id(3), helpstring("method OpenService")] HRESULT OpenService([in] BSTR serviceName, [out,retval] IDispatch** ppService); };
I havn't done ATL since VC 6.0 and I'm using 2003 .NET now. It auto creates the IDL file and outputs the OpenService function as OpenServiceA. Aren't BSTR's not supposed to require A/W or distinctions since they are always wide? I'm an ATL 7.0 noob so help me out ;-) -
It's common to see FunctionA and FunctionW for ANSI/UNICODE versions, however my ATL functions are being created like this which is not good. For example, I made a method called OpenService which returns an IService object (of my creation) and takes as a parameter a BSTR. So the declaration is as follows:
__interface IConfigurer : IDispatch { [id(1), helpstring("method Open")] HRESULT Open([in] BSTR machineName); [id(2), helpstring("method Close")] HRESULT Close(void); [id(3), helpstring("method OpenService")] HRESULT OpenService([in] BSTR serviceName, [out,retval] IDispatch** ppService); };
I havn't done ATL since VC 6.0 and I'm using 2003 .NET now. It auto creates the IDL file and outputs the OpenService function as OpenServiceA. Aren't BSTR's not supposed to require A/W or distinctions since they are always wide? I'm an ATL 7.0 noob so help me out ;-)I saw the EXACT same thing today! I have not yet fully investigated the matter further - I was on my way home when I spotted a method of mine, OpenService, having the name OpenServiceW. I am not 100% sure of what's going on, but it wouldn't surprise me that there's some function in the system headers that looks something like this:
#ifdef _UNICODE
#define OpenService OpenServiceW
#else
#define OpenService OpenServiceA
#endifIf you want to, you can investigate this and post what you find - that ought to be good reading tomorrow morning :) -- I am perpetual, I keep the country clean.