Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Nov 2003
Offline Last Active Today, 11:44 AM

Topics I've Started

How use delegates from c++

24 November 2015 - 11:48 AM

I try to implement passing delegates as arguments from script and call it from c++.
i use follow code to store script function - 

void ScriptModuleCore::Network::SetDelegate(DelegateAS& delegateAS, asIScriptFunction* cb)
   asIScriptEngine* engine = ((ScriptMachine*)(core->Script()->Machine()))->Machine();
   if (delegateAS.callback)
   if (delegateAS.callbackObject)
      engine->ReleaseScriptObject(delegateAS.callbackObject, delegateAS.callbackObjectType);
   delegateAS.callback = 0;
   delegateAS.callbackObject = 0;
   delegateAS.callbackObjectType = 0;
   if( cb && cb->GetFuncType() == asFUNC_DELEGATE )
      delegateAS.callbackObject     = cb->GetDelegateObject();
      delegateAS.callbackObjectType = cb->GetDelegateObjectType();
      delegateAS.callback           = cb->GetDelegateFunction();
      engine->AddRefScriptObject(delegateAS.callbackObject, delegateAS.callbackObjectType);

      delegateAS.callback = cb;

follow code executes script function

asIScriptContext* ctx = GrabContext();



All fine when we deal with just function. But if we pass delegate than we got assertion in AngelScript in follow function -

// internal
int asCScriptFunction::GetRefCount()
   asASSERT( funcType == asFUNC_DELEGATE );
   return externalRefCount.get();

Maybe i just doing something wrong when dealing with delegate from c++ or this is bug in AngelScript?

Very slow loading of bytecode on iOS

18 June 2015 - 09:41 AM



Currently we optimizing loading time of our application. Now 11 seconds needed to start application. After profiling we found that approximately 3 seconds needed to load byte code. According profile almost all time was spended in asCReader::Reader(bool*). More details are visible on screenshot - http://rghost.ru/7sxkVzWv8


It is possible to speed up loading of byte code? Loading speed are very critical to us and without your help we can't achieve satisfying result.

bug in scriptarray add-on

09 January 2015 - 04:55 AM



in scriptarray.cpp there are nasty bug in ScriptArrayIsEmpty_Generic function - result of self->IsEmpty is not returned to asIScriptGeneric, because missing call such as *reinterpret_cast<bool *>(gen->GetAddressOfReturnLocation()) = self->IsEmpty();

Binding cast functions

25 August 2014 - 03:28 AM



We are binding C++ classes and cast functions from base class. We get errors like this - "0:50.375 -  (0, 0) : ERR : Type 'SymbolInstSplashScreenSymbol' is still used by function 'SymbolInstSplashScreenSymbol@ NGUIWidget::_beh_10_()'" when in script we use cast functions. When we close scene angelscript are crushes (screenshot of call stack are attached). We use flags asBEHAVE_REF_CAST and asBEHAVE_IMPLICIT_REF_CAST when register cast functions.


If we are use flags asBEHAVE_VALUE_CAST and asBEHAVE_IMPLICIT_ witch looks like more properly because we do not need any reference count when use cast operator than all things became more badly - more errors comes and our scene crushes after binding not after closing as was before.


So looks like using cast functions leads to unnecessary reference count and this leads to internal crush of angelscript.

Loading binding data

25 August 2014 - 02:45 AM



Currently when we load scene in our engine we make lots of bindings. And this become huge bottleneck even on pc with iCore 5. So it is possible to save code bindigs and load this info like precompiled bytecode?