PDA

View Full Version : Sharing DAT between objects . . .



Don Pomplun
02-05-2007, 01:53 PM
It makes sense that a DAT block in one object isn't known about by another linked via an OBJ statement.
Is the "usual" way for them to have access to the same data for obj1 to pass a pointer to obj2 as parameters in obj2's start method? Or is there a better way?
-- Don

inservi
02-05-2007, 10:19 PM
Hello Don,

With the little experiences I have with Propeller and the read of a lot of example code, I can say that, yes it's the usual way to share data between some object.

Except if Mike Green know a better way, You need to transmit the argument as reference to the object (with '@' operator). And You can then if necessary modify the variable with the 'BYTE[], WORD[] or LONG[]' declaration.

Here are an example:





PUB main
change(@DS18B20Found)
' now DS18B20Found is equal to 1
' The method 'change' can be in another object


PUB change(varAdresse)
byte[varAdresse]:=1

DAT
DS18B20Found byte 0





dro

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
in medio virtus