Forum Discussion

Ashish_Gupta_15's avatar
Ashish_Gupta_15
Icon for Nimbostratus rankNimbostratus
May 26, 2015
Solved

BIG-IP 11.5.2 - PROCs - passing by reference

TCL has a keyword named upvar which is supported in Big IP 11.4.x. This is similar to using pass by reference. But this does not seem to be working for me. In the below case, the value of {test_var} should be 10 after the call to the proc. Instead It is still 1. Am I missing something? Is there a workaround?

Proc

proc testproc_byref { {test_var}} {
upvar 1 $test_var var
set var 10
log local0. "Inside the proc by ref. Setting its value to 10"
log local0. "test_var ${test_var}"
}

Caller

call TEST_LIB::testproc_byref ${test_var}
log local0. "AFTER calling the proc test_var : ${test_var}"

Output

Before calling the proc test_var : 1
Inside the proc by ref. Setting its value to 10
test_var 1
AFTER calling the proc test_var : 1
  • call TEST_LIB::testproc_byref ${test_var}

     

    shouldn't it be test_var rather than $test_var?

     

4 Replies