You are not logged in.

Dear visitor, welcome to Jabaco - Community. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

1

Saturday, January 24th 2009, 2:11pm

difference between ByVal, ByRef, ByJava

Hello,

in Java it is not possible to return a variables value by calling it ByRef in a function definition.

in VB6 wehn using ByRef there will be passed a pointer to the variable to the calling stack.

in Jabaco what is the difference between declaring a variable

in a function-definition ByVal, ByRef, ByJava?

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Public Sub Command1_Click()
   
   Dim i As Integer
   
   Call ReturnInteger(i)
   MsgBox i
   
   Call ReturnIntegerByRef(i)
   MsgBox i
   
   Dim ii(0 To 0) As Integer
   Call ReturnIntegerByJava(ii)
   MsgBox ii(0)
   
End Sub
Public Sub Command2_Click()
   
   Dim v As Variant
   
   Call ReturnVariant(v)
   MsgBox v
   Call ReturnVariantByRef(v)
   MsgBox v
   
' not possible
'   Dim vv(0 To 0) As Variant
'   Call ReturnVariantByJava(vv)
'   MsgBox vv(0)
'   
End Sub


Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Public Sub ReturnInteger(IntVal As Integer)
    IntVal = 10
End Sub
Public Sub ReturnIntegerByRef(ByRef IntVal As Integer)
    IntVal = 10
End Sub
Public Sub ReturnIntegerByJava(ByJava IntVal() As Integer)
    IntVal(0) = 10
End Sub
Public Sub ReturnVariant(VarVal As Variant)
    VarVal = 10
End Sub
Public Sub ReturnVariantByRef(ByRef VarVal As Variant)
    VarVal = 10
End Sub
Public Sub ReturnVariantByJava(Byjava VarVal() As Variant)
    VarVal(0) = 10
End Sub


greetings

+Oliver

Rate this thread
WoltLab Burning Board