Shop OBEX P1 Docs P2 Docs Learn Events
Question about an object declared more than once at various levels in a SPIN2 project — Parallax Forums

Question about an object declared more than once at various levels in a SPIN2 project

bob_g4bbybob_g4bby Posts: 583
edited 2026-03-20 09:25 in PASM2/Spin2 (P2)

Say I have a SPIN2 project:-

Does Spin Tools (and others) handle this as I expect so as to be economic in hub ram use:-
1. The dsplibrary methods - that have been used throughout the project - are loaded only once into hub ram (Assuming "Remove unused methods" selected)
2. Space for any variables declared in dsplibrary is made for as many times as dsplibrary is declared as objects in the project
3. If Toplevel didn't declare a dsplibrary object - it would have no access to child's dsplibrary, would it? In Toplevel, you can't say child.dsplibrary.method().

Cheers, bob

Comments

  • JonnyMacJonnyMac Posts: 9,759
    edited 2026-03-20 15:01

    In Toplevel, you can't say child.dsplibrary.method().

    No, you would have to expose your DSPlibrary methods from the child object. I do this from time to time; for example, the Nextion touch display is a serial device so it sits on top of a generic serial driver. I expose some of the serial driver methods in the Nextion object that are helpful during testing.

  • I get that, thanks Jon

  • JonnyMacJonnyMac Posts: 9,759
    edited 2026-03-20 15:03

    I kind of wish there was some mechanism in Spin that would allow public child methods to trickle upward. CONstants, too, although this could lead to namespace conflicts.

  • avsa242avsa242 Posts: 485
    edited 2026-03-20 15:45

    I don't know if it was ever intended or if it was a side-effect of some other feature added, but you can access "grandchildren" methods (and VARs/DATs) directly like that in FlexSpin.
    EDIT: Attached a simple example

  • bob_g4bbybob_g4bby Posts: 583
    edited 2026-03-20 17:18

    Yep, that runs for me too on FlexSpin, but not on Spin Tools or Pnut. Interesting! Thanks for the experiment.

Sign In or Register to comment.