Seems to be related to the debugger..



I now found that if I use "Start Without Debugging", everything works OK. I
only get garbage when I use "Start Debugging". I use VS2005 version
8.0.50727.42 I guess it's a MS bug. Weird!

/Fredrik

"Igor Tandetnik" <itandetnik@xxxxxxxx> skrev i meddelandet
news:efs0gZ1LGHA.1288@xxxxxxxxxxxxxxxxxxxxxxx
"Fredrik Wahlgren" <fredrik.p.wahlgren@xxxxxxxxxxxxxxxxxx> wrote in
message news:uC3NIQ1LGHA.2916@xxxxxxxxxxxxxxxxxxxx
In order
to try out the idea, I created a very simple internal function that
adds two floating point numbers, passed as strings. The return value
would also be a string. I called it like this
sSum = pFunc->xFunc(L"SUM", L"0,1", L"0,2"", L"0,3");

The result should be the string "0,6". All I get is garbage unless I
call it like this:

pFunc->raw_xFunc(L"SUM", L"0,1", L"0,2"", L"0,3", &sSum);

What's sSum? It should be _bstr_t or CComBSTR. If you use raw BSTR here,
you will end up with a dangling pointer - that's probably why you see
garbage. Note that ATL (or in general, the server side implementation) has
nothing to do with it - it is the artifact of #import-generated wrappers.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925



.



Relevant Pages

  • Re: Seems to be related to the debugger..
    ... I only get garbage when I use "Start Debugging". ... Is sSum declared as wstring, ... string is stored internally, deugger basically interpets first four bytes ...
    (microsoft.public.vc.atl)
  • Re: Seems to be related to the debugger..
    ... I only get garbage when I use "Start Debugging". ... Is sSum declared as wstring, ... implement small string optimization, ...
    (microsoft.public.vc.atl)
  • Re: Thread exiting with code 1282 (0x502)
    ... the application exits when I display a dialog that contains text boxes with some large strings. ... I start debugging with VS2005, interact with the application so that it displays a properties dialog for one of the graphics objects we have, then I click on a button that displays another dialog with four Combo Boxes. ... 3.- I get to the Combo Box again and I enter the new long string and this time I quickly press "OK" and save the object. ... Please let me know if the implementation of OnToolTipNotify() should be different. ...
    (microsoft.public.vc.mfc)
  • Re: Comments on Comments (was Re: Getting to 100 (#119))
    ... Computer Programming," comments can actually impede debugging. ... # yield each partitioning of the receiver into count partitions ... # an initial substring of increasing length, ... # the string into count-1 partitions. ...
    (comp.lang.ruby)
  • Re: About VS C++
    ... I like is that every object can be simply converted to a string and therefore simply printed - big plus for debugging. ... I base most of my objects on the TtiObject class which includes handy features such as the Visitor and Iterator design pattern. ... I can also do things like MyObject.AsDebugString which then outputs the objects to a string, including a few other handy things like the ObjectState. ... I searched about such information on the FPC site, but haven't found anything about generics. ...
    (borland.public.delphi.non-technical)