Login  Register

Re: Trouble getting QuantLibAddin to work with vc 7.1

Posted by eric ehlers on May 18, 2005; 7:03am
URL: http://quantlib.414.s1.nabble.com/Trouble-getting-QuantLibAddin-to-work-with-vc-7-1-tp10802p10805.html

On 5/18/05, Plamen Neykov <[hidden email]> wrote:

> Hi Eric,
>
> unfortunately the following program crashes also exactly in the same way as
> the add-in:
>
> #include <iostream>
> int main(int argc, char* argv[])
> {
>         char* p = "Test";
>         p[0] = 'P';
>         std::cout << p;
>         return 0;
> }
>
> It doesn't matter which compiler switches I use to compile it - either in the
> ide or via the command line. It crashes even if I compile it like that:
> cl Test.cpp
> My compiler version is 13.10.3077
>
> It seems to me that my compiler is placing string literals _allways_ in
> readonly memory disregarding the compiler switches I use .....
>
> Thanks & Regards
> Plamen

Hi Plamen

I guess this is the issue described here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrfstringliteralshavepropertypeofconstchar[].asp

Interestingly at this link ...
http://support.microsoft.com/default.aspx?scid=%2Fservicedesks%2Fwebcasts%2Fen%2Ftranscripts%2Fwct032003.asp
... it says "You need to compile this code at a command prompt without
using any specific compiler switches" - but you tried that and it
didn't fix the problem - I assume that that unofficial document is out
of sync with your version of VC7.1.

I think it should be straightforward to refactor the TempStr function
to not use string literals, I'll look into this and get back to you.

Regards
Eric