The helpfile says:
But it doesn't give any suggestions or workaroundsLocal variables in PureBasic are directly indexed by the stack pointer, which means if the stack pointer change via an ASM instruction (like PUSH, POP etc..) the variable index will be wrong and direct variable reference won't work anymore.
I hope you won't tell me i have to use a debugger and manually fiddle around with "p.v_var+4", "p.v_var+8" etc trying to get the stack alignment correct as that is a really ugly laborious slow and errorprone way, and i thought that is job for the compiler not programmer so i hope Purebasic has a practical solution . Or if we cant use local variables should I simply be using a different type, like Global, or...?
Thankyou for any tips
Code: Select all
Procedure Test() Protected xvar1.l = $11 Protected xvar2.l = $22 Protected xvar3.l = $33 PrintN("xvar1=" + Hex(xvar1)) ;$11 PrintN("xvar2=" + Hex(xvar2)) ;$22 PrintN("xvar3=" + Hex(xvar3)) ;$33 EnableASM ! int 3 ! push dword [p.v_xvar1] ;$11 ! push dword [p.v_xvar2] ;should be $22 but is $11 ! push dword [p.v_xvar3] ;should be $33 but is $11 DisableASM EndProcedure OpenConsole() Test()