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

Method CallGlobalFunctionRetBool

sdk/angelscript/source/as_scriptengine.cpp:4931–4958  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4929}
4930
4931bool asCScriptEngine::CallGlobalFunctionRetBool(void *param1, void *param2, asSSystemFunctionInterface *i, asCScriptFunction *s) const
4932{
4933 if( i->callConv == ICC_CDECL )
4934 {
4935 bool (*f)(void *, void *) = (bool (*)(void *, void *))(i->func);
4936 return f(param1, param2);
4937 }
4938 else if( i->callConv == ICC_STDCALL )
4939 {
4940 typedef bool (STDCALL *func_t)(void *, void *);
4941 func_t f = (func_t)(i->func);
4942 return f(param1, param2);
4943 }
4944 else
4945 {
4946 // TODO: When simulating a 64bit environment by defining AS_64BIT_PTR on a 32bit platform this code
4947 // fails, because the stack given to asCGeneric is not prepared with two 64bit arguments.
4948
4949 // We must guarantee the order of the arguments which is why we copy them to this
4950 // array. Otherwise the compiler may put them anywhere it likes, or even keep them
4951 // in the registers which causes problem.
4952 void *params[2] = {param1, param2};
4953 asCGeneric gen(const_cast<asCScriptEngine*>(this), s, 0, (asDWORD*)params);
4954 void (*f)(asIScriptGeneric *) = (void (*)(asIScriptGeneric *))(i->func);
4955 f(&gen);
4956 return *(bool*)gen.GetReturnPointer();
4957 }
4958}
4959
4960void *asCScriptEngine::CallAlloc(const asCObjectType *type) const
4961{

Callers 2

ReadInnerMethod · 0.80

Calls 1

GetReturnPointerMethod · 0.80

Tested by

no test coverage detected