It is obviously related to the new "shared" functionality. I'll investigate it.
Do you get the new function id or function object after the build? It may or may not be the same, so you should always get a fresh id/object after re-building a script.
Are you calling the MyFunc() object on the interface or the object?
ctx->Prepare(func); ctx->SetObject(obj); r = ctx->Execute(); if( r != asEXECUTION_FINISHED ) TEST_FAILED;
ctx->Release(); obj->Release();
engine->DiscardModule("1");
// Build the module again mod = engine->GetModule("1", asGM_ALWAYS_CREATE); mod->AddScriptSection("code", code); bout.buffer = ""; r = mod->Build(); if( r < 0 ) TEST_FAILED;
id = mod->GetTypeIdByDecl("cMyClass"); type = engine->GetObjectTypeById(id); func = type->GetMethodByDecl("void MyFunc()"); if( func == 0 ) TEST_FAILED;
There is nothing wrong with the script. It is perfectly valid to have a non-shared class inherit from a shared class. The other way around is not valid though.
I'll give this new script a try and see if I can reproduce the problem.
[EDIT] Yes, now I was able to reproduce the problem. What happens is that when you discarded the module the object types were orphaned, but not yet destroyed as the garbage collector had not yet executed. When re-compiling the script the previously compiled and shared class was found again, but as it was orphaned, i.e. didn't belong to any module the code didn't behave correctly when trying to find the object methods.