Main Content

Global data synchronization mode

Global data synchronization mode

Description

App Configuration Pane: Memory

Configuration Objects: coder.MexCodeConfig

Global data synchronization mode.

See Generate Code for Global Variables.

Settings

ValueDescription for Global DataDescription for Constant Global Data

'SyncAlways' (default)

This value is the default value.

Synchronizes global data at MEX function entry and exit and for extrinsic calls for maximum consistency between MATLAB® and the generated MEX function. To maximize performance, if the extrinsic calls do not change global data, use this option with the coder.extrinsic -sync:off option to turn off synchronization for these calls.

Verifies consistency of constant global data at MEX function entry and after extrinsic calls. If the global data values in the MATLAB global workspace are inconsistent with the compile-time constant global values in the MEX function, the MEX function ends with an error. Use the coder.extrinsic -sync:off option to turn off consistency checks after specific extrinsic calls.

'SyncAtEntryAndExits'

Synchronizes global data at MEX function entry and exit only. To maximize performance, if only a few extrinsic calls change global data, use this option with the coder.extrinsic -sync:on option to turn on synchronization for these calls.

Verifies constant global data at MEX function entry only. If the global data values in the MATLAB global workspace are inconsistent with the compile-time constant global values in the MEX function, the MEX function ends with an error. Use the coder.extrinsic -sync:on option to turn on consistency checks after specific extrinsic calls.

'NoSync'

Disables synchronization. Before disabling synchronization, verify that your MEX function does not interact with MATLAB global data. Otherwise, inconsistencies between MATLAB and the MEX function can occur.

Disables consistency checks.

At MEX-function entry, exit and extrinsic calls

Disabled

At MEX-function entry and exit

Programmatic Use

Property: GlobalDataSyncMethod
Values: 'SyncAlways' | 'SyncAtEntryAndExits' | 'NoSync'
Default: 'SyncAlways'

Version History

Introduced in R2011a