Thanks Daniel, that is an excellent tutorial!
Is this on BlitzWiki? Its Pointers article seems to be empty...
Anyway, here is a quick example to simply demonstrate creating a pointer, reading the pointed to value, and reading the address being pointed to. (A very important difference to know).
A few questions...
Can I create a pointer to a generic object?
Can BlitzMax automatically turn function parameters into pointers, so that the user of a library only has to pass a function as a parameter and it is automatically accessed as a pointer? (PHP does this, I believe).
Is this on BlitzWiki? Its Pointers article seems to be empty...
Anyway, here is a quick example to simply demonstrate creating a pointer, reading the pointed to value, and reading the address being pointed to. (A very important difference to know).
Strict Local MyVar:Int = 15 Print "My variable: " + MyVar Local MyVarPointer:Int Ptr = Varptr(MyVar) Print "My variable's memory address: " + Int(MyVarPointer) Print "My variable's value, accessed through a pointer!: " + MyVarPointer[0]
A few questions...
Can I create a pointer to a generic object?
Can BlitzMax automatically turn function parameters into pointers, so that the user of a library only has to pass a function as a parameter and it is automatically accessed as a pointer? (PHP does this, I believe).