I have included several VM macros inside my application. I have made sure that I have not nested any macros, but when I load my application in Code Virtualizer user interface, I get a nested macros message. What's wrong?

<< Click to Display Table of Contents >>

Navigation:  Code Virtualizer > FAQ > Macros >

I have included several VM macros inside my application. I have made sure that I have not nested any macros, but when I load my application in Code Virtualizer user interface, I get a nested macros message. What's wrong?

If you have not inserted nested macros and you get that message, you might be facing a compiler optimizations issue. Some compilers remove the VM_END marker when they are at the end of a procedure (or after a "return" statement) because the VM markers are in fact dummy code that might be affected by compiler optimizations.

 

Please, make sure that you avoid putting the VM_END marker after a "return" statement or as the last instruction in a function/procedure.

 

You can also disable local optimizations. In C/C++, you can disable local optimizations. Example:

 

#pragma optimize("", off)

 

void MyFunction(void)

{

   VM_START

 

   // your code

 

   VM_END

}

 

#pragma optimize("", on)