I am using ATL 7 (with attributes) and I have been
passing back a SAFEARRAY wrapped in a VARIANT from a
property get method. This works fine.
I am wanting to return a plain SAFEARRAY, i.e. not wrap
it up in a VARIANT.
However, I cannot figure out the syntax to get it to put
SAFEARRAY(BSTR*) in the idl file.
For example, I currently have the method in the interface:
[id(4), propget]
HRESULT TheAnalysts([out, retval] VARIANT* pAnalysts);
Changing it to this doesn't work:
[id(4), propget]
HRESULT TheAnalysts([out, retval] SAFEARRAY** ppAnalysts);
midl fails to compile the IDL. This makes sense since the
generated IDL doesn't have the correct SAFEARRRAY
(typename) syntax. Putting in SAFEARRAY(BSTR*) for
example means it doesn't compile due to syntax errors
(again understandably).
I've searched for an attribute to make this work but I
couldn't find anything.
Any ideas?
Thanks,
Robert Greig
--
Sorry for bad English.
"Robert Greig" <robert....@jpmorgan.com> wrote in message
news:041d01c3397a$0801e0c0$a001...@phx.gbl...
error C2143: syntax error : missing ',' before '*'
You'd expect to put that in the IDL but with ATL 7.0 with
attributes you put everything directly into the C++.
Any other ideas?
Thanks,
Robert
>.
>
compiles fine for me.
Brian
Hmm. I cannot understand what I am doing wrong.
Here is my complete interface (in a file on its own):
#include "stdafx.h"
[
object,
uuid("2D1420B6-F66F-4969-A094-8542A3198682"),
dual,
helpstring("IKey Interface"),
pointer_default(unique)
]
__interface IKey : IDispatch
{
[id(1), propget]
HRESULT Id([out, retval] SAFEARRAY(BSTR) *pId);
};
When I compile it I get these errors:
error C2143: syntax error : missing ',' before '*'
error C3763: 'SAFEARRAY': 'retval' and 'out' can only
appear on a data-pointer type
error C3763: 'SAFEARRAY': 'retval' and 'out' can only
appear on a data-pointer type
Can you spot what is wrong? NB - not sure if it matters
but I'm using VC++ 2003.
Thanks,
Robert
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcattrib/html/vcrefsatype.asp
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Robert Greig" <robert....@jpmorgan.dot.com> wrote in message news:07ef01c33989$b786bf70$a601...@phx.gbl...
"Robert Greig" <robert....@jpmorgan.dot.com> wrote in message
news:03be01c339b1$2a848b70$a101...@phx.gbl...
--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnic...@mvps.org
MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================
"Brian Muth" <bm...@straightthroughnospam.com> wrote in message news:e8%235rNbO...@TK2MSFTNGP10.phx.gbl...