How to pass a reference to a CComBSTR
- From: "Steve Franks" <please@xxxxxxxxxxxxxxxxx>
- Date: Sat, 30 Jul 2005 14:42:42 -0400
I have a CComBSTR variable in function A. I want to pass this variable to
function B by REFERENCE, so that function B can update this variable with a
new string it calculates.
I'm passing in my CComBSTR like this: myfunction(& myCComBSTRvar)
and myfunction looks like this:
void myfunction(CComBSTR *myCComBSTRvarToUpdate) {}
This call is occuring within the same component and not across COM boundies
etc. Just one function within my ATL object needing to call another
function.
However when I compile I get:
test.cpp(235) : error C2664: 'myfunction' : cannot convert parameter 1 from
'unsigned short ** ' to 'class ATL::CComBSTR *'
>From searching I've read that you cannot pass a CComBSTR by reference
because it overloads the & operator.
I am using Visual Studio 6.0 and that is my only option. What is the MOST
EFFICIENT way I can handle this need? I read something from Microsoft about
using a "container" if you need to pass a CComBSTR by reference, but I'm not
sure what they mean. Can someone provide a quick example of that?
Clearly I could pass my CComBSTR by value and return a string, and then once
it gets back I could just set the CComBSTR to the returned string value.
However this is a very critical piece of the code where performance is
critical and this code is called intensively so performance optimization
matters the most here.
Thanks in advance for any help you can provide.
Steve
.
- Follow-Ups:
- Re: How to pass a reference to a CComBSTR
- From: Heinz Ozwirk
- Re: How to pass a reference to a CComBSTR
- From: Egbert Nierop \(MVP for IIS\)
- Re: How to pass a reference to a CComBSTR
- Prev by Date: Re: COM dll in use by Windows Explorer
- Next by Date: Re: How to pass a reference to a CComBSTR
- Previous by thread: Re: COM dll in use by Windows Explorer
- Next by thread: Re: How to pass a reference to a CComBSTR
- Index(es):
Relevant Pages
|
Loading