Click here to Skip to main content
15,886,422 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
This is the first time I am trying to use SAFEARRAYs.
I have the following method declaration in IDL:
C++
//.IMyObj2
[
	object,
	uuid(3454B81A-65A9-4F3E-8678-1D5F82B25837),
	oleautomation,
	nonextensible,
	helpstring("IMyObj2 Interface"),
	pointer_default(unique)
]
interface IMyObj2 : IDispatch{
};
//.IArrayMan3 
[
	object,
	uuid(EF532C8B-12A9-4FEC-B91C-D7502FD68874),
	oleautomation,
	nonextensible,
	helpstring("IArrayMan3 Interface"),
	pointer_default(unique)
]
interface IArrayMan3 : IUnknown{
	[helpstring("method GetArray")] 
	HRESULT _stdcall GetArray2(SAFEARRAY(IMyObj2*)* pArray);
	[helpstring("method PutArray")] 
	HRESULT _stdcall PutArray2(SAFEARRAY(IMyObj2*) pArray);
};

I get the following warning:
warning MIDL2456 : SAFEARRAY(interface pointer) doesn't work using midl generated proxy : [ Parameter 'pArray' of Procedure 'PutArray2' ( Interface 'IArrayMan3' ) ]



Thanks in advance.
Posted
Comments
[no name] 17-Sep-12 22:38pm    
http://social.msdn.microsoft.com/Forums/en/vcmfcatl/thread/84a632a9-4e29-4a95-8da7-f7aedb650339
Mem 9021960 18-Sep-12 4:25am    
I've seen that forum, but I don't resolve the warnings.
Thank you in detail.

1 solution

Have you declared it as a library? If so, you can use OleView utility to check output in your .tlb file.
I receive this warning only if there is no library incapsulation for this interfaces.

The other way to avoid this warning message might be using the following trick:
C++
struct SMyObj{
    IMyObj2 * iobject;
};

interface IArrayMan3 : IUnknown{
[helpstring("method GetArray")]
HRESULT _stdcall GetArray2(SAFEARRAY(struct SMyObj*)* pArray);
[helpstring("method PutArray")]
HRESULT _stdcall PutArray2(SAFEARRAY(struct SMyObj*) pArray);
};
 
Share this answer
 
v2
Comments
Mem 9021960 18-Sep-12 6:12am    
Thank you for your detail.
Using the 2nd method, I resolved the warnings.
I declared it at *.idl file using VS2008.
Sorry, Could you help for "I receive this warning only if there is no library incapsulation for this interfaces."?
Thank you again.
skydger 18-Sep-12 6:55am    
Sure, no problem :)
I use VS2005, so it has no library declaration in .idl file's template. The code is following:

[
uuid(00000001-0001-0001-0001-000000000099),
version(1.0),
helpstring("Library for my interfaces")
]
library MyIfcLibrary{
[
object,
uuid(00000002-0002-0002-0002-000000000002),
oleautomation,
nonextensible,
helpstring("First Interface"),
pointer_default(unique)
]
interface IFirstInterface : IDispatch{
};
...
};
If project set up properly, you'll get .tlb file in output directory after building a project.
Mem 9021960 18-Sep-12 20:58pm    
Thank you Mr.skydger.
Received a lot of help from you.
skydger 19-Sep-12 4:35am    
You're welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900