Lets say I have a module named "MODULE" and a config group of global functions that only that module can use called "MOD_FUNCS", giving us the following code
int r;engine->BeginConfigGroup("MOD_FUNCS");r=engine->RegisterGlobalFunction("void foo()",asFUNCTION(foo), asCALL_CDECL); assert(r>0);r=engine->RegisterGlobalFunction("void bar()",asFUNCTION(bar), asCALL_CDECL);assert(r>0);engine->EndConfigGroup();// then create the module using CScriptBuilderr=module_builder.StartNewModule("MODULE");assert(r>0);engine->SetConfigGroupModuleAccess("MOD_FUNCS","MODULE",true); // set the module to access the config group.r=module_builder.AddSectionFromFile(script.c_str());assert(r>0);r=module_builder.BuildModule();assert(r>0);// do stuff with the module where the script uses the functions in the config group.// now everything is done and the functions in the config group are no longer needed and the module is also not needed.r=engine->DiscardModule("MODULE");r=engine->RemoveConfigGroup("MODULE_FUNCS");
My question is this, after the config group "MODULE_FUNCS" as been removed, are the functions that were registered to it also released or are they still being held by the engine instance?
If they are, what are other ways I could variably add and remove global functions, or better yet, register functions to a module directly. My goal is for certain features of my application, I want to avoid the need to having the client have to import functions from another module in order to use them, as well as keep memory usage low when such functions are not needed.