<< Click to Display Table of Contents >> Navigation: Code Virtualizer > FAQ > Macros > I have added a few VIRTUALIZER macros inside my application, but when I load my compiled application on Code Virtualizer it says "missing START - END macro" |
Please, notice that macros are in fact "dummy" code that does nothing (it's just recognized by Code Virtualizer). If you put the VIRTUALIZER_END at the end of a procedure, the compiler might remove the VIRTUALIZER_END code when optimizations are enabled. If you compile with optimizations disabled, you should not have any problems.
The following code might generate a "missing" macro pair:
YourFunction() { VIRTUALIZER_START // your code goes here return; VIRTUALIZER_END } |
The compiler knows that after the "return" statement, no code is executed, so it won't generate code for the VM_END marker. To avoid the above problem, just put it like:
YourFunction() { VIRTUALIZER_START // your code goes here VIRTUALIZER_END return; } |
Also, you might want to disable optimizations in those places where macros are used, to make sure that compiler optimizations won't remove any macro markers. For C/C++ language you can use the following directive:
#pragma optimize("", off) YourFunction() { VIRTUALIZER_START // your code goes here return; VIRTUALIZER_END } #pragma optimize("", on) |
You should be able to use the same approach for other programming languages.