Shop OBEX P1 Docs P2 Docs Learn Events
Sharing DAT between objects . . . — Parallax Forums

Sharing DAT between objects . . .

Don PomplunDon Pomplun Posts: 116
edited 2007-02-05 14:19 in Propeller 1
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

Comments

  • inserviinservi Posts: 113
    edited 2007-02-05 14:19
    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[noparse]/noparse, WORD[noparse]/noparse or LONG[noparse]/noparse' 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[noparse][[/noparse]varAdresse]:=1
    
    DAT
      DS18B20Found    byte    0
    
    
    



    dro

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    in medio virtus
Sign In or Register to comment.