Studio:Scl ptr flist: Difference between revisions
Jump to navigation
Jump to search
m (Scl ptr flist moved to Studio:Scl ptr flist) |
m (Text replace - 'Category: SCL' to 'Category:Studio:SCL') |
||
Line 50: | Line 50: | ||
[[Category: Function Pointers]] | [[Category: Function Pointers]] | ||
[[Category: SCL]] | [[Category:Studio:SCL]] |
Revision as of 00:11, 21 August 2009
The scl_ptr_flist pragma
The scl_ptr_flist() pragma is used to specify the candidate functions that are available for a specific function pointer data type.
#pragma scl_ptr_flist(type-name, default-name) #pragma scl_ptr_flist(type-name, field-name, default-name) #pragma scl_ptr_flist(type-name, candidate-1, candidate-2..n) #pragma scl_ptr_flist(type-name, field-name, candidate-1, candidate-2..n)
Syntax
Parameters | Type | Description |
type-name | String | Name of the type that contains the function pointer |
field-name | Member | Name of the pointer member within the struct/union or in the parameter list of the function |
candidate-1 | String | Name of the candidate function |
candidate-2..n [Optional] | String | Optional name(s) of additional candidate function(s) |
default-name | Quoted string | Name to be assigned to the default function (quoted string) |
Notes
- The syntax shown in form 1 of 4 above should only be used when function pointers are part of the command payload.
- The syntax shown in form 2 of 4 above should only be used when returning function pointers.
- A function pointer data type as written in ANSI C merely specifies the format of the prototype. The format of the prototype is the data type of the return value and the datatypes of the parameters, if any. The scl_ptr_flist() pragma is therefore required by the SCL compiler to indicate which SCL-compatible interfaces are associated with a particular function pointer data type.
- When a payload contains a field that is a pointer to a function, it is possible that the receiver of such a payload may make a call using the value received. Because the set of possible functions that might be passed is very large, and because all remotable methods must be identified with a SUID, each such payload value be constrained to identify the specific set of functions that might be passed. These are referred to as the candidates. Each candidate must be known by its name. The scl_brew_class() and scl_ptr_flist() pragmas are used for constraining fields of type pointer to function in this way.
- Payload fields of type pointer to function that are not explicitly associated with a list of candidates are treated as if they have been declared as void *.
See Also
- For additional information on scl_ptr_flist(), including constraints, refer to the section on scl_ptr_flist() in the SCL Reference Guide.