This test case must reproduce problem:
bool Test()
{
bool fail = false;
int r;
COutStream out;
asIScriptModule *mod1, *mod2;
asIScriptEngine *engine;
CBytecodeStream stream1(__FILE__"shared1");
CBytecodeStream stream2(__FILE__"shared2");
CBytecodeStream stream3(__FILE__"shared3");
CBytecodeStream stream4(__FILE__"shared4");
asDWORD crc1, crc2;
{
engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL);
mod1 = engine->GetModule(0, asGM_ALWAYS_CREATE);
mod1->AddScriptSection("test",
"funcdef void CALLBACK();\n");
r = mod1->Build();
if( r < 0 )
TEST_FAILED;
mod2 = engine->GetModule(0, asGM_ALWAYS_CREATE);
mod2->AddScriptSection("test",
"funcdef void CALLBACK(); \n"
"void Foo1(CALLBACK@){} \n"
"void Foo2(){Foo1(null);}\n");
r = mod2->Build();
if( r < 0 )
TEST_FAILED;
r = mod1->SaveByteCode(&stream1);
if( r < 0 )
TEST_FAILED;
r = mod2->SaveByteCode(&stream2);
if( r < 0 )
TEST_FAILED;
crc1 = ComputeCRC32(&stream2.buffer[0], asUINT(stream2.buffer.size()));
engine->Release();
}
{
engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL);
mod1 = engine->GetModule(0, asGM_ALWAYS_CREATE);
r = mod1->LoadByteCode(&stream1);
if( r < 0 )
TEST_FAILED;
mod2 = engine->GetModule(0, asGM_ALWAYS_CREATE);
r = mod2->LoadByteCode(&stream2);
if( r < 0 )
TEST_FAILED;
r = mod1->SaveByteCode(&stream3);
if( r < 0 )
TEST_FAILED;
r = mod2->SaveByteCode(&stream4);
if( r < 0 )
TEST_FAILED;
crc2 = ComputeCRC32(&stream4.buffer[0], asUINT(stream4.buffer.size()));
if( crc1 != crc2 )
TEST_FAILED;
engine->Release();
}
{
engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL);
mod1 = engine->GetModule(0, asGM_ALWAYS_CREATE);
r = mod1->LoadByteCode(&stream3);
if( r < 0 )
TEST_FAILED;
mod2 = engine->GetModule(0, asGM_ALWAYS_CREATE);
r = mod2->LoadByteCode(&stream4);
if( r < 0 )
TEST_FAILED;
engine->Release();
}
// Success
return fail;
}