Can't seem to compile a SAFEARRAY member for my interface
-
I am creating a COM interface to some library I have and I am trying to make an Initialize function that takes as it argument a SAFEARRAY of BSTR's. I am using VS .NET 2000 and the ATL wizard. I added an object and am manually adding the entry for the function since SAFEARRAY is not an option for the auto-add member wizard. Here is what I have so far:
__interface IiidApplication : IDispatch { [id(1),helpstring("method Initialize")] HRESULT Initialize([in] SAFEARRAY(BSTR) *par); }
Then later I have the function defined as STDMETHOD(Initialize)(LPSAFEARRAY pvar); The IDL will not compile however. I get errors on the Initialize line complaining about an extra ) and missing ) and ; before *. If I remove the (BSTR) and just leave it as SAFEARRAY *par, it will not link because it complains about not knowing the size of the array or similar. All the MS doc's seem to have the format as SAFEARRAY(your datatype) but it doesn't seem to be working for me. Any suggestions? -
I am creating a COM interface to some library I have and I am trying to make an Initialize function that takes as it argument a SAFEARRAY of BSTR's. I am using VS .NET 2000 and the ATL wizard. I added an object and am manually adding the entry for the function since SAFEARRAY is not an option for the auto-add member wizard. Here is what I have so far:
__interface IiidApplication : IDispatch { [id(1),helpstring("method Initialize")] HRESULT Initialize([in] SAFEARRAY(BSTR) *par); }
Then later I have the function defined as STDMETHOD(Initialize)(LPSAFEARRAY pvar); The IDL will not compile however. I get errors on the Initialize line complaining about an extra ) and missing ) and ; before *. If I remove the (BSTR) and just leave it as SAFEARRAY *par, it will not link because it complains about not knowing the size of the array or similar. All the MS doc's seem to have the format as SAFEARRAY(your datatype) but it doesn't seem to be working for me. Any suggestions? -
I am creating a COM interface to some library I have and I am trying to make an Initialize function that takes as it argument a SAFEARRAY of BSTR's. I am using VS .NET 2000 and the ATL wizard. I added an object and am manually adding the entry for the function since SAFEARRAY is not an option for the auto-add member wizard. Here is what I have so far:
__interface IiidApplication : IDispatch { [id(1),helpstring("method Initialize")] HRESULT Initialize([in] SAFEARRAY(BSTR) *par); }
Then later I have the function defined as STDMETHOD(Initialize)(LPSAFEARRAY pvar); The IDL will not compile however. I get errors on the Initialize line complaining about an extra ) and missing ) and ; before *. If I remove the (BSTR) and just leave it as SAFEARRAY *par, it will not link because it complains about not knowing the size of the array or similar. All the MS doc's seem to have the format as SAFEARRAY(your datatype) but it doesn't seem to be working for me. Any suggestions? -
I am creating a COM interface to some library I have and I am trying to make an Initialize function that takes as it argument a SAFEARRAY of BSTR's. I am using VS .NET 2000 and the ATL wizard. I added an object and am manually adding the entry for the function since SAFEARRAY is not an option for the auto-add member wizard. Here is what I have so far:
__interface IiidApplication : IDispatch { [id(1),helpstring("method Initialize")] HRESULT Initialize([in] SAFEARRAY(BSTR) *par); }
Then later I have the function defined as STDMETHOD(Initialize)(LPSAFEARRAY pvar); The IDL will not compile however. I get errors on the Initialize line complaining about an extra ) and missing ) and ; before *. If I remove the (BSTR) and just leave it as SAFEARRAY *par, it will not link because it complains about not knowing the size of the array or similar. All the MS doc's seem to have the format as SAFEARRAY(your datatype) but it doesn't seem to be working for me. Any suggestions?This is one of the interfaces in my project and it compiles without any problem in both Vc 6.0 and VS 2003. I have'nt tried VS.Net 2002 but it should work. The only difference is that mine is a IUnknown interface
interface IMyInterface : IUnknown { ........ HRESULT MyFunction( [in] SAFEARRAY(BSTR)* inputArray); };
FYI, The implementation of this method in ur .h must look likeSTDMETHOD(MyFunction)(SAFEARRAY** inputArray);
Hope this helps. prashu