AddSectionFromFile will add the text.
LoadByteCode will load the ByteCode.
Please tell me if there is a way to add a ByteCode as AddSectionFromFile.
Questions about how to add a ByteCode
Hi, LoadBytecode() will load the entire script module as it was built with the Build() function. There is currently no way of saving or loading a partial script module.
Can you elaborate on what you're trying to accomplish? Perhaps there is something I might consider for future releases.
Can you elaborate on what you're trying to accomplish? Perhaps there is something I might consider for future releases.
AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game
previous versions were able to add angelscript_2.22.1 ByteCode by overriding the CScriptBuilder. from angelscript_2.22.2 was that this will not be able to.
int CScriptBuilderEx::Build()
{
// int r = module->Build();
int r = ModuleBuild(); // Change
if( r < 0 )
return r;
int CScriptBuilderEx::ModuleBuild()
{
// Only one thread may build at one time
// TODO: It should be possible to have multiple threads perform compilations
int r = ((asCScriptEngine*)engine)->RequestBuild();
if( r < 0 )
return r;
((asCScriptEngine*)engine)->PrepareEngine();
if( ((asCScriptEngine*)engine)->configFailed )
{
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_INVALID_CONFIGURATION);
((asCScriptEngine*)engine)->BuildCompleted();
return asINVALID_CONFIGURATION;
}
// ((asCModule*)module)->InternalReset();
if( !((asCModule*)module)->builder )
{
((asCScriptEngine*)engine)->BuildCompleted();
return asSUCCESS;
}
// Compile the script
r = ((asCModule*)module)->builder->Build();
asDELETE(((asCModule*)module)->builder,asCBuilder);
((asCModule*)module)->builder = 0;
if( r < 0 )
{
// Reset module again
((asCModule*)module)->InternalReset();
((asCScriptEngine*)engine)->BuildCompleted();
return r;
}
((asCModule*)module)->JITCompile();
((asCScriptEngine*)engine)->PrepareEngine();
((asCScriptEngine*)engine)->BuildCompleted();
// Initialize global variables
if( r >= 0 && ((asCScriptEngine*)engine)->ep.initGlobalVarsAfterBuild )
r = ((asCModule*)module)->ResetGlobalVars(0);
return r;
}
int CScriptBuilderEx::Build()
{
// int r = module->Build();
int r = ModuleBuild(); // Change
if( r < 0 )
return r;
int CScriptBuilderEx::ModuleBuild()
{
// Only one thread may build at one time
// TODO: It should be possible to have multiple threads perform compilations
int r = ((asCScriptEngine*)engine)->RequestBuild();
if( r < 0 )
return r;
((asCScriptEngine*)engine)->PrepareEngine();
if( ((asCScriptEngine*)engine)->configFailed )
{
engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_INVALID_CONFIGURATION);
((asCScriptEngine*)engine)->BuildCompleted();
return asINVALID_CONFIGURATION;
}
// ((asCModule*)module)->InternalReset();
if( !((asCModule*)module)->builder )
{
((asCScriptEngine*)engine)->BuildCompleted();
return asSUCCESS;
}
// Compile the script
r = ((asCModule*)module)->builder->Build();
asDELETE(((asCModule*)module)->builder,asCBuilder);
((asCModule*)module)->builder = 0;
if( r < 0 )
{
// Reset module again
((asCModule*)module)->InternalReset();
((asCScriptEngine*)engine)->BuildCompleted();
return r;
}
((asCModule*)module)->JITCompile();
((asCScriptEngine*)engine)->PrepareEngine();
((asCScriptEngine*)engine)->BuildCompleted();
// Initialize global variables
if( r >= 0 && ((asCScriptEngine*)engine)->ep.initGlobalVarsAfterBuild )
r = ((asCModule*)module)->ResetGlobalVars(0);
return r;
}
The internals of the script engine were never intended to be accessed directly by the application. Of course, you're free to do so in your project as you like, but you cannot make any assumptions that it will continue to work with new releases.
You didn't tell me what you're trying to accomplish.
If you just want to dynamically add functions and global variables, you can use the asIScriptModule::CompileFunction and CompileGlobalVar to do that.
You didn't tell me what you're trying to accomplish.
If you just want to dynamically add functions and global variables, you can use the asIScriptModule::CompileFunction and CompileGlobalVar to do that.
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
Popular Topics
Advertisement