Skip to content

Why does Code Virtualizer report a missing START or END macro?

The macro markers are dummy code that Code Virtualizer recognizes. With optimizations enabled, a compiler may remove a VIRTUALIZER_END marker placed after a return statement or at the end of a function.

This code may produce the error because the end marker is unreachable:

YourFunction()
{
    VIRTUALIZER_START
    // your code goes here
    return;
    VIRTUALIZER_END
}

Place the end marker before return:

YourFunction()
{
    VIRTUALIZER_START
    // your code goes here
    VIRTUALIZER_END
    return;
}

If necessary, disable optimization around functions that contain macros. In C/C++:

#pragma optimize("", off)
YourFunction()
{
    VIRTUALIZER_START
    // your code goes here
    return;
    VIRTUALIZER_END
}
#pragma optimize("", on)

Use the equivalent local optimization setting for other languages.