I tried the GetSafeArrayPtr()
method which returns a LPSAFEARRAY* that a typedef defined as:
typedef /* [wire_marshal] */ SAFEARRAY *LPSAFEARRAY;
I thought I would be able to directly assign this to a SAFEARRAY* variable but the compiler gives this error:
error C2440: '=' : cannot convert from 'LPSAFEARRAY *' to 'SAFEARRAY *'
I found this strange. What am I doing wrong here?
PS: I am doing this inside a C++/CLI dll (if that is of any relevance).
LPSAFEARRAY *
is a pointer toSAFEARRAY *
, so you need a double pointer, like this:And then you can pass the
SAFEARRAY *
to the function that needs it as an argument by dereferencing the pointer returned fromCComSafeArray
: