I'm adding AngelScript support to my game and when I call
scriptEngine->RegisterGlobalFunction("void printOutput(string &str)", asFUNCTION(printOutput), asCALL_CDECL)
my app crashes My printOutput looks like this:
void printOutput(std::string &str)
{
MyEngine::Instance().console->print(str.c_str());
}
The crash is caused when the RegisterGlobalFunction somehow calls my function from RegisterGlobalFunction(), the value for str passed to printOutput is an invalid pointer. How can I fix this? Thanks