Scl function: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | |||
The ''SCL function'' pragma allows capturing a global function for doubling or remoting. During the build process the [[Build Tools | Stride Compiler]] generates [[Intercept Module|IM source code]] that provides the correct logic for the test. | |||
<source lang=c> | |||
int foo(int x); | |||
void boo(void); | |||
== Syntax == | #pragma scl_function(foo) | ||
#pragma scl_function(boo, "DEFINITION", "IMPLICIT", "TEST_GROUP") | |||
</source> | |||
=== Syntax === | |||
The ''scl_function'' pragma allows the user to capture a function. When captured for the purpose of interception (in which case the term '''intercept-able''' is used throughout the documentation) optional arguments allow specification of how the intercept should be executed. The [[s2sinstrument|Instrument Build Tool]] will use those options to generate appropriate function interception code. | |||
#pragma scl_function(function-name [,context, name-mangling, group-id]) | #pragma scl_function(function-name [,context, name-mangling, group-id]) | ||
Line 32: | Line 39: | ||
|} | |} | ||
== Notes == | === Notes === | ||
* The function must be declared as a designator with external linkage. | * The function must be declared as a designator with external linkage. | ||
* A compilation error is reported if an attempt is made to capture a function more than once (with either [[scl_func]] or scl_function). | * A compilation error is reported if an attempt is made to capture a function more than once (with either [[scl_func]] or scl_function). | ||
Revision as of 22:16, 1 July 2015
The SCL function pragma allows capturing a global function for doubling or remoting. During the build process the Stride Compiler generates IM source code that provides the correct logic for the test.
int foo(int x);
void boo(void);
#pragma scl_function(foo)
#pragma scl_function(boo, "DEFINITION", "IMPLICIT", "TEST_GROUP")
Syntax
The scl_function pragma allows the user to capture a function. When captured for the purpose of interception (in which case the term intercept-able is used throughout the documentation) optional arguments allow specification of how the intercept should be executed. The Instrument Build Tool will use those options to generate appropriate function interception code.
#pragma scl_function(function-name [,context, name-mangling, group-id])
Parameters | Type | Description |
function-name | Identifier | Name of the function to capture. |
context | String | Optional. Context in which the function is going to be intercepted. Possible values are "REFERENCE" - intercept at the function call (aka user) or "DEFINITION" - intercept at the function definition (aka owner). |
name-mangling | String | Optional. Type of name mangling to be used when intercepted. Possible values are "EXPLICIT" or "IMPLICIT". |
group-id | String | Optional. User defined identifier representing the group to which this function belongs when solving name mangling conflicts. |
Notes
- The function must be declared as a designator with external linkage.
- A compilation error is reported if an attempt is made to capture a function more than once (with either scl_func or scl_function).