Click to See Complete Forum and Search --> : Params passed to COM work in debug


DaveF
February 6th, 2003, 04:34 PM
But they fail when I run the service out of Debug Mode.

I have tried this with the debug executible and the release executable.

the parameters are variants in the COM object so I'm using code similar to this:

_variant_t vParam = new _variant_t;
vParam.SetString(m_sLocalVar);

spIface->MyMethod(&vParam);

I set up Logging in the COM object so I could see what was being passed to the function.

When I run the service in debug mode everything works fine. When I launch the service from the Service Control window nothing is passed to the function.

Any ideas?

Thanks for the help,
Dave

PadexArt
February 7th, 2003, 01:50 AM
If the _variant_t object that you pass is an out argument, does it "live" after you've made the call? If allocated on stack, it will destroy the underlying BSTR once it gets out of scope.

DaveF
February 7th, 2003, 07:27 AM
I don't know if it's an out argument. I am passing a reference to to the object (&vParam) and the object doesn't go out of existance until well after the function that needs it has completed.

If I change the function in the DLL to accept the parameter by value instead of reference would that fix the problem?