problems marshaling arbitrary sized arrays of structs



trying to send back an arbitrary sized array of data from one exe to
another, but only the first item is copied.

here's the idl for the method

HRESULT GetBananas([out] DWORD *numBananas, [out, size_is(,*numTags)]
Banana** bananas);

struct Banana
{
DWORD length;
BSTR favoriteName;
};

In GetBananas I allocate the required memory with CoTaskMemAlloc (or
CoTaskMemRealloc).
Only the first item gets copied, the rest of the items in bananas array
are just garbled stuff...

I assume my IDL declaration is wrong, what's up with it ?

p.s. - just for testing I tried to change the Banana to a DWORD, hence
sending back an array of DWORDs, got the same results, only first item
has meaningful data...

.



Relevant Pages

  • Re: Confused about ATL and SafeArrays
    ... I put together a test method using your sample method, IDL, and .h ... My ASP code looks like this: ... The type mismatch always occurs on the line "result = ... the Array function works to call the method but passing in the name ...
    (microsoft.public.vc.atl)
  • confused about image colorspaces
    ... I'd like to write a small applet to display astronomical images. ... customary in astronomy, for us an image is an array imgof real ... a lookup table (LUT) of R G B values (the LUT is also chosen by the ... As example this is the equivalent IDL codes (the Java R G B values will ...
    (comp.lang.java.programmer)
  • Re: Cant send message
    ... all array keys should be quoted unless you're passing ... Array references inside double quotes behave differently. ... echo "A banana is."; ...
    (comp.lang.php)
  • Re: optional Safearray of UDTs from VB
    ... phEngine.DoProcess InstMeasure 'VB ARRAY / safearray parameter ... > I think I already told you to use a VARIANT, ... >> or spoof either the idl or vb to acheive a result similar to functional ...
    (microsoft.public.vc.atl)
  • Re: Fire SAFEARRAY(BYTE) to outer COM object crashes
    ... Your subject title suggests you are using SAFEARRAYin your IDL. ... > I'd like to fire an event passing an array of BSTR. ... you fire an event with Invoke method passing 0x2 as ... > dispIdMember, the program crashes. ...
    (microsoft.public.vc.atl)