Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global variable dies when sent as a parameter??
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00179903
Message ID:
00180193
Views:
28
>I think I've found the problem. Do you invke the procedure with DO...WITH...? Passing a PUBLIC by REFERENCE (the default) results in the PUBLIC being hidden. the following code snippet demonstrates this nicely:
>
>
>PUBLIC cTest
>cTest = 'ByRef'
>DO MyFunc WITH cTest
>ctest = 'ByVal'
>=MyFunc(cTest)
>CANCEL
>
>PROCEDURE MyFunc
>LPARAMETER uVar
>? uVar
>? 'The type of the parameter is',TYPE('uVar')
>? 'The type of the PUBLIC cTest is',TYPE('cTest')
>RETURN
>
>
>You can force a pass by value by invoking the procedure as a function, or by enclosing the argument to the WITH in parentheses to force a pass by value. This behavior of PUBLICs passed by reference is actually documented somewhere...


Hi,

The above is quite true when you you send parameters by reference, but I send the parameters by value (SET UDFPARMS TO VALUE) and that's why it troubles me. The phenomena also occurs regardless of me using LPARAMETERS or PARAMETERS in the procedure.

Thanks...
(using VFP 3.0 for Win & Mac)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform