C - Module handle

From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 18-Nov-2017 00:11 UTC

C - Module handle

Get the instance handle for a constructed instance

Contents

Synopsis

 
 
 
 
#include <«pkg»/«Mod».h>
 
«Mod»_Struct obj;
«Mod»_Handle inst = «Mod»_handle(&obj) /* type-safe cast of a «Mod»_Struct* to a «Mod»_Handle*/

Description

«Mod»_handle() provides a type-safe means for converting the address of a constructed instance to a «Mod»_Handle().

Example

In the example below, an instance object is created from a structure allocated on the stack.

 
 
 
 
 
 
 
 
 
 
 
 
 
int main(void) {    
    Mod_Struct obj;               /* instance object struct */
    Mod_Handle inst;              /* instance handle */
 
    /* initialize a pre-allocated instance object */
    Mod_construct(&obj, NULL);    /* create a Mod instance from obj */
 
    /* call a method that requires a Mod_Handle */
    inst = Mod_handle(&obj);      /* type-safe cast of &obj to a Mod_Handle */
    Mod_«someOperation»(inst);
 
    return 0;
}

See also

C - construct Initialize a new instance object from a provided structure

[printable version]  [offline version]offline version generated on 18-Nov-2017 00:11 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved
Personal tools
package reference