Advertisement

LoadByteCode fails when there is a function with the same name in the namespace.

Started by June 21, 2018 09:41 AM
2 comments, last by WitchLord 6 years, 5 months ago

{
    engine = asCreateScriptEngine();
    engine->SetMessageCallback(asMETHOD(CBufferedOutStream, Callback), &bout,
                               asCALL_THISCALL);
    bout.buffer = "";

    mod = engine->GetModule("test", asGM_ALWAYS_CREATE);
    mod->AddScriptSection(
        "test",
	"namespace X { shared float A()  {return 0.f;} }"
        "namespace Y { shared float A()  {return 0.f;} }"
        "void test() {"
        "	float v;"
        "	v = Y::A();"
        "}");
    r = mod->Build();
    if (r < 0)
      TEST_FAILED;

    CBytecodeStream bc1("test");
    r = mod->SaveByteCode(&bc1);
    assert(r >= 0);
    if (r < 0)
      TEST_FAILED;

    mod = engine->GetModule("test", asGM_ALWAYS_CREATE);
    r = mod->LoadByteCode(&bc1);
    if (r < 0)
      TEST_FAILED;

    if (bout.buffer != "") {
      PRINTF("%s", bout.buffer.c_str());
      TEST_FAILED;
    }

    engine->ShutDownAndRelease();
}

When you execute the above, it becomes as follows.


 (0, 0) : Error   : LoadByteCode failed. The bytecode is invalid. Number of bytes read from stream: 146

 

Thanks. I'll look into it.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

I've fixed this in revision 2514.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement