1.1.19. scriba_GettingConfiguration()

[<<<] [>>>]

scriba_LoadConfiguration() and scriba_InheritConfiguration() can be used to specify configuration information for a ScriptBasic program. Here we describe the differences and how to use the two functions for single-process single-basic and for single-process multiple-basic applications.

To execute a ScriptBasic program you usually need configuration information. The configuration information for the interpreter is stored in a file. The function scriba_LoadConfiguration() reads the file and loads it into memory into the SbProgram object. When the object is destroyed the configuration information is automatically purged from memory.

Some implementations like the Eszter SB Engine variation of ScriptBasic starts several interpreter thread within the same process. In this case the configuration information is read only once and all the running interpreters share the same configuration information.

To do this the embedding program has to create a pseudo SbProgram object that does not run any ScriptBasic program, but is used only to load the configuration information calling the function scriba_LoadConfiguration(). Other SbProgram objects that do intepret ScriptBasic program should inherit this configuration calling the function scriba_InheritConfiguration(). When a SbProgram object is destroyed the configuration is not destroyed if that was inherited belonging to a different object. It remains in memory and can later be used by other intrepreter instances.

Inheriting the configuration is fast because it does not require loading the configuration information from file. This is essentially sets a pointer in the internal interpreter structure to point to the configuration information held by the other object and all the parallel running interpreters structures point to the same piece of memory holding the common configuration information.

See the configuration handling functions scriba_LoadConfiguration() and scriba_InheritConfiguration().


[<<<] [>>>]