🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Script isn't building

Started by
25 comments, last by Jayanth Kannan 16 years, 6 months ago
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.


Advertisement
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.
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?

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

You're absolutely right, I've messed up with calling convention :-)
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

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

actually there are no differences in the way I'm registering other functions over this one. just this function wont work. i need to see if there is a pattern though. will let you know soon.

This topic is closed to new replies.

Advertisement