Siebel VB Language Reference > Using Siebel VB > Guidelines for Using Siebel VB >

Pass Values Through Reference


Where possible, it is recommended that you pass a value through a reference and not through a variable. Passing a value through a variable is less efficient then passing the same value through a reference. You must write code that passes a value through a variable unless it cannot pass the same value through a reference.

Passing a Value Through a Reference

Siebel CRM can pass a variable to a subroutine or a function through a reference. Each method determines if it can receive a value from a variable or a reference. A subroutine or function can modify this value.

Passing a Value Through a Variable

Siebel CRM can pass a value to a function through a variable. After processing is complete, the variable retains the value that it contained before Siebel CRM passed it, even though the subroutine or function might modify the passed value.

If you configure Siebel CRM to pass a variable to a method that modifies the corresponding argument, and if you must retain the value that this variable contains, then you must enclose the variable in parentheses in the Call Subroutine statement. This format instructs Siebel VB to pass a copy of the variable. This technique is known as passing a value through a variable. For more information, see Call Subroutine Method.

If Siebel CRM passes a variable to a function, and if an argument for this function expects to receive a value through a reference, then this variable must match the exact type of the argument. This requirement does not apply to an expression or a variant.

If you configure Siebel CRM to call an external DLL, then you can configure the ByVal keyword to pass an argument through a value. You specify this configuration in the Declare Procedure statement or in the Call Subroutine statement. If you specify the ByVal keyword in the declaration, then the ByVal keyword is optional in the call. If you use the ByVal keyword, then it must precede the value. If you do not specify the ByVal keyword in the declaration, and if you specify the data type in the declaration, then you cannot use the ByVal keyword in the call.

For more information, see Declare Procedure Method.

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.