CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2003
    Location
    Maine, USA
    Posts
    14

    Params passed to COM work in debug

    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
    Live Life... It's not a dress rehearsal

  2. #2
    Join Date
    Aug 2002
    Location
    Cluj-Napoca,Romania
    Posts
    3,496
    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.
    Har Har

  3. #3
    Join Date
    Jan 2003
    Location
    Maine, USA
    Posts
    14
    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?
    Live Life... It's not a dress rehearsal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured