From RTSC-Pedia
[printable version] [offline version] | offline version generated on 02-Oct-2009 22:10 UTC |
C - Instance init
Module's instance initialization function
Contents |
Synopsis
| #include "package/internal/«Mod».xdc.h" /* non-@InstanceInitError modules only */ Void «Mod»_Instance_init(«Mod»_Object *obj, const «Mod»_Params *params) /* @InstanceInitError modules only */ Int «Mod»_Instance_init(«Mod»_Object *obj, const «Mod»_Params *params , Error_Block *eb) |
Description
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()!
See also
C - create | Allocate and initialize a new instance object and return its handle |
C - construct | Initialize a new instance object inside the provided structure |
C - Instance_finalize | Module's instance finalization function |
[printable version] [offline version] | offline version generated on 02-Oct-2009 22:10 UTC |