Typelib marshalling BSTRs

Mike Hearn mike at theoretic.com
Fri Jul 18 11:24:07 CDT 2003


On Fri, 2003-07-18 at 17:08, Kelly Leahy wrote:
> weird.  are the "type" and "flags" correct?

They appear to be. Type 26 is VT_PTR, flags 1 == in param

> bstr isn't right, since it's an array of bstr (or more precisely array of
> OLECHAR FAR* - which may also be causing problems) - though I may be wrong
> if it marshals them one by one.  

Yeah, I had a thinko. It's supposed to be an array of bstr, but even
simply marshalling the first element correctly would be good :)

> Shouldn't there be some special attributes
> in the IDL for this stuff, like size_of() or something like that (I'm a bit
> rusty)?

  HRESULT GetIDsOfNames(
    [in] REFIID riid,
    [in, size_is(cNames)] LPOLESTR *rgszNames,
    [in] UINT cNames,
    [in] LCID lcid,
    [out, size_is(cNames)] DISPID *rgDispId);

Maybe the size_is() field should be noticed somewhere in the marshalling
code. I don't know where such information would surface though, it's not
in the flags, there is no PARAMFLAG constant for it.

> these should be identical in terms of the code that gets compiles, though
> the second form may eliminate some warnings by using the typecast.
> Incidentally, you could just use (DWORD*)args to have the same effect.

Hm, so if you declare an array like so:

DWORD args[32];

and then pass args as a parameter of type "DWORD *args", it
automatically gets the address of it? I thought passing variables
directly like that would normally cause a copy by value, but I don't
know C well enough I suppose.




More information about the wine-devel mailing list