Andrewc,
The problem is that PB only defines labels like v_a$ for variables at a global level.
Within procedures the paramaters and local paramaters are created on the stack.
Here's some code that would work the way you want it to:
Code: Select all
Procedure.s UseString(*String.l)
DefType.s Result
!MOV eax,dword [esp]
!MOV [esp+4], eax
ProcedureReturn Result
EndProcedure
String1.s = "Once upon a time..."
String2.s = UseString(@String1)
Debug "[" + Hex(@String1) + "] " + String1
Debug "[" + Hex(@String2) + "] " + String2
esp is the stack pointer. The paramater is at the top of the stack (esp).
The local variable is the next item on the stack (esp+4).
Question to the Gurus: If no procedure return is defined the compiler will add a default return. Is there any way to supress this so that the above function could be defined simply as '!MOV eax,dword [esp]', leaving eax as the return value?