LOTUSSCRIPT LANGUAGE
Passing arguments by reference
When an argument is passed by reference, the C function receives a 4-byte pointer to the value area.
In some cases, the actual stack argument is changed to a publicly readable structure. In all cases, the data may be changed by the called function, and the changed value is reflected in LotusScript variables and in the properties of product objects. For such properties, this change occurs directly after the call has returned.
(including a collection)
Passing arguments by value
When an argument is passed by value, the C function receives a copy of the actual value of the argument.
If the call is made with a variable, changes to the string by the C function are reflected in the variable. This is not true for a string argument to a LotusScript function declared as ByVal.
Any of the data types that can be passed by value can also be passed by reference.
The argument ByVal 0& specifies a null pointer to a C function, when the argument is declared as Any.
Example
Declare Sub SemiCopy Lib "mylib.dll" _ (valPtr As Long, ByVal iVal As Long) Dim vTestA As Long, vTestB As Long vTestA = 1 vTestB = 2 SemiCopy vTestA, vTestB
' The C function named SemiCopy receives a 4-byte pointer to a ' 2-byte integer containing the value of vTestA, and a 2-byte ' integer containing the value of vTestB. ' Since vTestA is passed by reference, SemiCopy can dereference ' the 4-byte pointer and assign any 2-byte integer to that ' location. When control returns to LotusScript, vTestA ' contains the modified value. Since vTestB was passed by ' value, any changes made by the C function are not reflected ' in vTestB after the function call.
See Also