To reproduce :
m_pAsEngine = (asIScriptEngineXPN *)asCreateScriptEngine(ANGELSCRIPT_VERSION);
CString csTmpCode = "void sdf(){}\nvoid sdf(){}";
m_pAsEngine->AddScriptSection("toto", "zefunc", csTmpCode, csTmpCode.GetLength());
m_pAsEngine->Build("toto", NULL);
Do you see the error in the script ? Yes, I have entered 2 time the same function (sdf) !
You get an assert caused by:
void asCBuilder::CompileFunctions()
at
functions[n]->script->ConvertPosToRowCol(functions[n]->node->tokenPos, &r, &c);
To solve this problem that I did get in my project but for different reasons (I was calling two times the AddScriptSection without calling the build in between those two calls), I have call the Discard methos of asIScriptEngine.
Then another bug appears.
To Reproduce :
CString csTmpCode = "void sdf(){}";
m_pAsEngine->AddScriptSection("toto", "zefunc", csTmpCode, csTmpCode.GetLength());
m_pAsEngine->Build("toto", NULL);
m_pAsEngine->Discard("toto");
You get an assert caused by :
void asCModule::Discard()
at
delete this;