🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

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

Started by
2 comments, last by WitchLord 6 years 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

 

Advertisement

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

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