std:string & VS.NET 2003

Started by
9 comments, last by WitchLord 19 years ago
Hi! First of all, AngelScript is really cool :) I have a problem with stdstring add-on and VS .NET 2003. When I add stdstring.h/cpp to my project, compiler fails with internal compiler error. Is this a known problem with VS, or am I doing something wrong? TIA
Advertisement
First: Thanks! :)

I'm not aware of any issues with VC++ .NET 2003, but then I haven't gotten around to test it yet.

In VC++ 6 everything is working fine.

Would it be possible for you to determine at what call the compiler fails? For example by commenting lines until the compiler stops failing. It might be a problem with how the addresses for the std::string methods are taken.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I use vc.net 2003 with no problems.

The internal compiler error is often due to a missing semi colon i believe.
Hi!

stdstring compiles fine in a trivial project. Internal compiler error is generated in my small test project (I have added #include <stdafx.h> at the top of the file). If I comment out lines 162 and 163 (asBEHAVE_EQUAL and asBEHAVE_NOTEQUAL behaviors), it compiles ok. Also, if I leave the lines and change operators in the third argument to something else (e.g. <=, >=), stdstring compiles ok.

Hi
You do not need to add string.h and string.cpp to your project. Just do #include and use it. I never had any problems with it anytime :|
Anonymous: I'm not talking about STL's include files. I'm talking about angelscript's addon code that allows you to register and use STL's string in scripts.
It seems there is a bug in MSVC .NET 2003 that prevents it from taking the address of the comparison operators. You should be able to make a couple of simple wrappers for them:

bool std_string_equal(const std::string &a, const std::string &b){  return a == b;}bool std_string_not_equal(const std::string &a, const std::string &b){  return a != b;}r = engine->RegisterGlobalBehaviour(asBEHAVE_EQUAL, "bool f(const string &in, const string &in)",   asFUNCTION(std_string_equal), asCALL_CDECL); assert( r >= 0 );r = engine->RegisterGlobalBehaviour(asBEHAVE_NOTEQUAL, "bool f(const string &in, const string &in)",   asFUNCTIONPR(std_string_not_equal), asCALL_CDECL); assert( r >= 0 );


It might also be that function signature for the operators is slightly different from what I assumed in the code. Check the header for std::string to verify the correct function signature.

Also check the Microsoft for any eventual patches to Visual Studio, or Visual C++, that might resolve this case.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

WitchLord:
I've checked std::string operator signatures, they seem ok to me.

I have also tested stdstring in VS 6 (SP5, I think), and internal compiler error is generated unless I comment out *all* comparison operators, including + operator (that's the block that starts at line 162) Again, this happens in a fairly large project. I didn't have the time to test a trivial project under VS6 (trivial project in VS.NET 2003 compiles ok)
Interesting.

I'll see if I can reproduce the problem with the latest service pack for VC6 (if I can find it somewhere for download).

Thanks for letting me know.

Did you try the wrappers?

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Yes, I added the wrappers and they work fine (at least the ones I tried :)

This topic is closed to new replies.

Advertisement