<< Click to Display Table of Contents >> Navigation: WinLicense > FAQ > Macros > Can VM macros protect switch statements? We are now having an issue with VM macros crashing the application. |
Switch-Case statements cannot work with VM macros in most compilers.
Compilers generate a direct jump table in the data section which directly jumps to each "case" statement. When the code is virtualized, the jump goes into a virtualized (garbage) code and it produces exception. You can use a workaround to protect your switch-case statements with VM macros, like:
switch (var) { case 0:
VM_START
// your code
VM_END
case 1:
VM_START
// your code
VM_END
... } |