From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC

XDCspec - @InstanceInitError

This module's instance initialization can fail

This attribute is applicable only to modules with instances. If this attribute is specified for a module, its internal instance initialization function (Mod_Instance_init) is passed an Error_Block pointer (as its third parameter) so that it can raise an error. In addition, this function must always return a non-negative integer value. If an error is raised, the return value from this function is passed to any Mod_Instance_finalize method (in the second parameter)

If Mod_Instance_init returns -1, the finalize method is not passed a second parameter(!) and, depending on how the finalize method uses this parameter, may result in undefined program behavior(!).

The examples below illustrate the instance initialization method signature for a module named Foo both with and without the @InstanceInitError attribute.

with @InstanceInitError
 
 
 
 
 
 
 
 
#include <xdc/runtime/Error.h>
#include "package/internal/Foo.xdc.h"
 
Int Foo_Instance_init(Foo_Object *obj, const Foo_Params *params, Error_Block *eb)
{
       :
    return (0);
}

without @InstanceInitError
 
 
 
 
 
 
#include "package/internal/Foo.xdc.h"
 
Void Foo_Instance_init(Foo_Object *obj, const Foo_Params *params)
{
       :
}
[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved


Views
Personal tools
package reference