Thursday, May 17th 2012, 4:38pm UTC+2

You are not logged in.

  • Login
  • Register

OlimilO

Intermediate

Posts: 277

Location: Germany

Occupation: software engineer

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