here you go
r = scriptengine->RegisterGlobalFunction("void SetCameraPos(float, float, float)", asFUNCTION(SetCameraPos), asCALL_STDCALL); assert( r >= 0 );
and the function
void SetCameraPos(float x, float y, float z)
{
D3DXVECTOR3 look = D3DXVECTOR3(x,y,z) + *g_Camera.GetWorldAhead();
g_Camera.SetViewParams( &D3DXVECTOR3(x,y,z), &look );
}
---------------------
a very simple function actually. a lot of other functions are working correctly.
Script isn't building
my 5 cents.
I've got the same error (Run-Time Check Failure #0 ...) inside my message callback function.
_AS_engine->SetMessageCallback(asFUNCTION(_AS_message_callback), &_err_log, asCALL_STDCALL);
the function is:
void _AS_message_callback(void* param1, void* param2);
there was no such error in AS 2.7.1b.
I've got the same error (Run-Time Check Failure #0 ...) inside my message callback function.
_AS_engine->SetMessageCallback(asFUNCTION(_AS_message_callback), &_err_log, asCALL_STDCALL);
the function is:
void _AS_message_callback(void* param1, void* param2);
there was no such error in AS 2.7.1b.
Jayanth and mono2k:
Are you certain that your functions are using the __stdcall calling convention? By default the compilers usually use __cdecl, though you may have changed your settings. For the sake of eliminating possiblities, could you try registering your functions with asCALL_CDECL instead of asCALL_STDCALL?
By the way, what compilers are you using?
Are you certain that your functions are using the __stdcall calling convention? By default the compilers usually use __cdecl, though you may have changed your settings. For the sake of eliminating possiblities, could you try registering your functions with asCALL_CDECL instead of asCALL_STDCALL?
By the way, what compilers are you using?
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
Visual C++ .NET 2005, soon to be moving to 2008. I'm sure i'm following the right conventions, because it works for other similar functions.
Did you test registering the function with asCALL_CDECL as I suggested? The fact that it works for other similar functions indicates that the problem really is with the way the function was registered, and not a bug in AngelScript.
Could you run the test_feature application in the tests folder and see if it reports any problems with your compiler? Pay special attention to the test in teststdcall4args.cpp file. That test case is very similar to your problem.
Regards,
Andreas
Could you run the test_feature application in the tests folder and see if it reports any problems with your compiler? Pay special attention to the test in teststdcall4args.cpp file. That test case is very similar to your problem.
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement