I need to maintain an array of objects references and pass each item to functions to manage it. I know I can do something like that:
Dim arrObjs As MyObject[]
Dim refObj As MyObject
arrObjs.Add(New MyObject) 'First reference to the Object.
refObj=arrObjs[0] 'Second reference to the same Object.
I think that is right, but reading Gambas Object Model documentation, I read that when passing an argument by reference (ByRef) there is no pointer involved. Instead, the value is copied inside the function and then copied again outside the function after function finish. Example:
Sub manageObject(ByRef refObj As MyObject)
.....
End
Calling time:
manageObject(ByRef arrObjs[0])
How can I manage true references to Objects inside procedures? Is there something like that?
Dim obj As New MyObject 'Correct
Dim objInstance As MyObject 'Correct
Dim refObj as Pointer 'Correct
refObj=varPtr(obj) 'NOT Correct, but i would like
objInstance=Object@(refObj) 'NOT Correct, but i would like