MCPcopy Create free account
hub / github.com/anjo76/angelscript / CallGlobalFunction

Method CallGlobalFunction

sdk/angelscript/source/as_scriptengine.cpp:4905–4929  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4903}
4904
4905void asCScriptEngine::CallGlobalFunction(void *param1, void *param2, asSSystemFunctionInterface *i, asCScriptFunction *s) const
4906{
4907 if( i->callConv == ICC_CDECL )
4908 {
4909 void (*f)(void *, void *) = (void (*)(void *, void *))(i->func);
4910 f(param1, param2);
4911 }
4912 else if( i->callConv == ICC_STDCALL )
4913 {
4914 typedef void (STDCALL *func_t)(void *, void *);
4915 func_t f = (func_t)(i->func);
4916 f(param1, param2);
4917 }
4918 else
4919 {
4920 // We must guarantee the order of the arguments which is why we copy them to this
4921 // array. Otherwise the compiler may put them anywhere it likes, or even keep them
4922 // in the registers which causes problem.
4923 void *params[2] = {param1, param2};
4924
4925 asCGeneric gen(const_cast<asCScriptEngine*>(this), s, 0, (asDWORD*)&params);
4926 void (*f)(asIScriptGeneric *) = (void (*)(asIScriptGeneric *))(i->func);
4927 f(&gen);
4928 }
4929}
4930
4931bool asCScriptEngine::CallGlobalFunctionRetBool(void *param1, void *param2, asSSystemFunctionInterface *i, asCScriptFunction *s) const
4932{

Callers 4

SendToCallbackMethod · 0.80
CallLineCallbackMethod · 0.80
CallExceptionCallbackMethod · 0.80
HandleAppExceptionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected