The OpenD Programming Language

dynamicCompileConst

When applied to global variable, this variable will be treated as constant by any dynamically compiled functions and is subject to optimizations. All dynamically compiled functions must be recompiled after any update to such variable.

This attribute has no effect if dynamic compilation wasn't enabled with -enable-dynamic-compile

immutable
auto dynamicCompileConst = _dynamicCompileConst();

Examples

import ldc.attributes;

@dynamicCompileConst __gshared int value = 1;

@dynamicCompile int foo() { return value * 42; }

Meta