Advertisement

Crash when calling RegisterGlobalFunction()

Started by February 09, 2006 10:37 AM
2 comments, last by WitchLord 19 years ago
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
Are you saying that RegisterGlobalFunction() is calling the function you're registering? That shouldn't be possible, try debugging the library to see what's going on.

If it is really the script that is calling your function, and passing an invalid string reference then you'll want to take a look at how the string type was registered.

Perhaps if you could show us a little bit more about how you're configuring the engine, then we might be able to help you better.

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

Advertisement
Sorry, my mistake, the problem wasn't RegisterGlobalFunction but the function I used with SetCommonMessageStream. Now fixed it, sorry I made you waste time answering.
No problem :)

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

This topic is closed to new replies.

Advertisement