From RTSC Central

Jump to: navigation, search
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 02-Aug-2008 00:08 UTC

C - Instance init

Module's instance initialization function

synopsis
 
 
Void Mod_Instance_init(Mod_Object *obj, const Mod_Params *params)
Int Mod_Instance_init(Mod_Object *obj, const Mod_Params *params , Error_Block *eb) /* @InstanceInitError modules only */

Modules that support instances must implement this initialization function, where "Mod" is the name of the module. The type signature of this function depends on whether (or not) Mod has the @InstanceInitError attribute. If Mod is declared with @InstanceInitError, an Error_Block pointer is passed to this function and this function can fail (by raising an error with this Error_Block pointer); otherwise, it must always succeed.

If Mod_Instance_init() fails, its return value is passed, largely uninterpreted, to Mod_Instance_finalize() to allow finalization to more easily cleanup any partially created state.

Mod_Instance_init() must never return -1; this one distinguished value is used internally to know if the state argument should be passed to Mod_Instance_finalize. Returning -1 from Mod_Instance_init() will result in an uninitialized value being passed to Mod_Instance_finalize()!


Views
Personal tools