r = engine->RegisterGlobalFunction("int AddImage( int Im, bstr caption, int x, int y, int width, int height )",
asFUNCTION(AddImage), asCALL_CDECL); assert( r >= 0);
This seems to cause the problem, basically whichever functions have a bstr in them, i would like to change it to stdstring if it's an easy step, if you can tell me how exactly to use them, cos i have used bstr only in the function prototypes. i would still prefer keeping to date rather than using a depracated method
AngelScript 1.10.1b STABLE (2004/12/01)
Ahh, that explains it. [wink]
Well, if you want to use std::string instead of string, the first thing you'll have to do is to call RegisterStdString() instead of RegisterBStr(). It will register the 'string' type (not 'bstr'), so you'll have to change all your uses of 'bstr' to 'string'. Then you'll have to change all your registered application functions to receive std::string, instead of bstr. When using std::string you'll not have to worry about deallocating the memory in the application functions as C++ will do it for you, this is why I recommend using it instead of bstr.
Also, I haven't prepared any formatting functions like bstrFormat(), so if you're using them you'll have to write them yourself. That shouldn't be too much work, just use the bstr functions as a base and change them to return a std::string instead.
Regards,
Andreas
Well, if you want to use std::string instead of string, the first thing you'll have to do is to call RegisterStdString() instead of RegisterBStr(). It will register the 'string' type (not 'bstr'), so you'll have to change all your uses of 'bstr' to 'string'. Then you'll have to change all your registered application functions to receive std::string, instead of bstr. When using std::string you'll not have to worry about deallocating the memory in the application functions as C++ will do it for you, this is why I recommend using it instead of bstr.
Also, I haven't prepared any formatting functions like bstrFormat(), so if you're using them you'll have to write them yourself. That shouldn't be too much work, just use the bstr functions as a base and change them to return a std::string instead.
Regards,
Andreas
I dont use any of those Formatting functions so it wouldnt matter, Is there any other thing i need to keep in mind before i change to string?
I can't think of any right now. Have you checked out the upgrade instructions available in the documentation for AngelScript?
Everything seems to work fine and the new version works great! Yippee!!! Massive Performance gains, i have'nt officially tested the changes though! will get back with results!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement