|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Glenn Flood (GFlood_at_SOUTHAMPTON.OILFIELD.SLB.COM)
Date: Tue Jul 30 2002 - 09:51:21 CDT
Make sure you remove BSTRs from UDTs that are
copied into a safe arrays after using AddElement().
i.e.
Create 'UdtTemplate' variable
Add data to UdtTemplate
Add BSTR to UdtTemplate
Copy UdtTemplate to Safe Array using AddElement()
Remove BSTR from UdtTemplate
UdtTemplate goes out of scope at end of function like a normal structure
My UDTs only contain numbers and BTSRs, and VB
appears to handle safearrays containing them them
without a problem.
Glenn :)
> -----Original Message-----
> From: Distributed COM-Based Code [mailto:DCOM
DISCUSS.MICROSOFT.COM]On
> Behalf Of arun
> Sent: 30 July 2002 14:55
> To: DCOM
DISCUSS.MICROSOFT.COM
> Subject: variantclear and [in,out] parameters
>
>
> Hi
>
> I would like to hear a definite answer from someone
> regarding variantclear
>
> I have many in,out parameters in many out of process
> calls. Most of them are variants that recieve or give
> SAFEARRAYS of multiple types (including UDT's)
> I use a simeple call to Variantclear() to free them
>
> Is it ok to assume that any kind of complex data
> except the ones mentioned in the documentation
> (VT_DISPATCH|VT_BYREF and so on)
> would be freed automatically ? Or should i be looking
> at some kindof CoTaskmemFree etc ?
>
> I also pass pointer of local variables(non variants) at times
> which gets the value correctly and goes out of scope
> in the normal way without any errors and i get the value placed
> in them too. Should they be replaced by ComTaskAlloce'd
> pointers to memory ?
>
>
> Any help would be appreciated as it will allow me to
> look at other areas of my application without worrying
> about com memory allocations
>
> arun
>
>
>
>
>
> ----------------------------------------------------------------
> Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
> contains important info. Save time, search the archives at
> http://discuss.microsoft.com/archives/index.html .
> To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
----------------------------------------------------------------
Users Guide http://discuss.microsoft.com/archives/mailfaq.asp
contains important info. Save time, search the archives at
http://discuss.microsoft.com/archives/index.html .
To unsubscribe, mailto:DCOM-signoff-request
DISCUSS.MICROSOFT.COM
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]