Chapter 5
Generated Code Architecture
5-50
ni.com
Shared Memory Callout Option
AutoCode supports a shared memory callout for all access to elements in
shared memory. Callouts are generated when the
-smco
option is specified.
The previous discussion about shared variable blocks still applies.
However, the generated code is different, and you must supply the
definitions of the callouts.
Read Shared Variable Block Callouts
There are currently four callouts used when reading from a shared variable
block. The difference is to accommodate different data types. The
prototypes are:
RT_FLOAT Read_Shared_Varblk_Float(long offset);
RT_INTEGER Read_Shared_Varblk_32(long offset);
RT_INTEGER Read_Shared_Varblk_16(long offset);
RT_INTEGER Read_Shared_Varblk_8(long offset);
There is a callout for
RT_FLOAT
, 32-bit (
RT_INTEGER
,
RT_ULONG
, and
RT_SLONG
), 16-bit (
RT_USHORT
and
RT_SSHORT
) and 8-bit (
RT_UBYTE
and
RT_SBYTE
)
data types.
Example 5-23 uses the
Read_Shared_Varblk...
syntax.
Write Shared Variable Block Callouts
There are currently four callouts used when writing to a shared variable
block. The difference is to accommodate different data types. The
prototypes are:
void Write_Shared_Varblk_Float(long offset, RT_FLOAT value);
void Write_Shared_Varblk_32(long offset, RT_INTEGER value);
void Write_Shared_Varblk_16(long offset, RT_INTEGER value);
void Write_Shared_Varblk_8(long offset, RT_INTEGER value);
There is a callout for
RT_FLOAT
, 32-bit (
RT_INTEGER
,
RT_ULONG
, and
RT_SLONG
), 16-bit (
RT_USHORT
and
RT_SSHORT
) and 8-bit (
RT_UBYTE
and
RT_SBYTE
) data types.
Example 5-23 uses the
Write_Shared_Varblk_Float(long offset)
syntax.
Example 5-23
Shared Variable Block Generated Code With Callouts (Using the -vbco and -smco Options)
/* ------------------------------- Read from Variable */
Enter_Shared_Varblk_Section(4);
proc2_4_1 = Read_Shared_Varblk_Float(&isi_varblk[0]->block5[0]);