Announcement

Collapse
No announcement yet.

memory allocation problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16


    Actually theres something wrong with the way the compiler is building the startup code,

    Try it this way and it works fine.

    #constant TEXT_BUFFER_SIZE 4

    var pageBuffer0[TEXT_BUFFER_SIZE];
    var pageBuffer1[TEXT_BUFFER_SIZE];
    var pageBuffer2[TEXT_BUFFER_SIZE];
    var pageBuffer3[TEXT_BUFFER_SIZE];
    var pageBuffer4[TEXT_BUFFER_SIZE];
    var pageBuffer5[TEXT_BUFFER_SIZE];

    var pageTextBuffers[6];

    func main()
    var i, n;
    *pageTextBuffers := [pageBuffer0,pageBuffer1,pageBuffer2,pageBuffer3,pageBuffer4,pageBuffer5]; //
    // or
    //*pageTextBuffers := [&pageBuffer0[0],&pageBuffer1[0],&pageBuffer2[0],&pageBuffer3[0],&pageBuffer4[0],&pageBuffer5[0]];
    Regards,
    Dave

    Comment


    • #17


      Great!

      That's a much safer fix than adding the offset myself.

      As frustrating as this has been, I really do appreciate the extremely quick help. Thanks again!

      -Colin

      Comment


      • #18
        I nearly "went mad" yesterday trying to initialize and array of array (string) this way :
        HTML Code:
        // GLOBAL VARIABLES
        var lab1[10], lab2[10], lab3[10], lab4[10], lab5[10], lab6[10], lab7[10], lab8[10], lab9[10], lab10[10];
        var lab11[10], lab12[10], lab13[10], lab14[10], lab15[10], lab16[10], lab17[10], lab18[10], lab19[10], lab20[10];
        var lab21[10], lab22[10], lab23[10], lab24[10], lab25[10], lab26[10], lab27[10], lab28[10], lab29[10], lab30[10];
        var lab31[10], lab32[10], lab33[10], lab34[10], lab35[10], lab36[10], lab37[10], lab38[10], lab39[10], lab40[10];
        
        var controlPage_Labels[40] := [  lab1, lab2, lab3, lab4, lab5, lab6, lab7, lab8, lab9, lab10,
                            lab11 , lab12 , lab13 , lab14 , lab15 , lab16 , lab17 , lab18 , lab19 , lab20 ,
                            lab21 , lab22 , lab23 , lab24 , lab25 , lab26 , lab27 , lab28 , lab29 , lab30 ,
                            lab31 , lab32 , lab33 , lab34 , lab35 , lab36 , lab37 , lab38 , lab39 , lab40 ];and not being able to get anything workingTried the solution sugested here :var controlPage_Labels[40];
        
        main()
            *controlPage_Labels := [  lab1, lab2, lab3, lab4, lab5, lab6, lab7, lab8, lab9, lab10,
                            lab11 , lab12 , lab13 , lab14 , lab15 , lab16 , lab17 , lab18 , lab19 , lab20 ,
                            lab21 , lab22 , lab23 , lab24 , lab25 , lab26 , lab27 , lab28 , lab29 , lab30 ,
                            lab31 , lab32 , lab33 , lab34 , lab35 , lab36 , lab37 , lab38 , lab39 , lab40 ];
        and ..... IT WORKED. I am re-establish in my "sanity". Thanks a lot guys for working it out. But this should definitely be put in the language document in a special section on say "the in and outs of arrays and strings".Cool I can carry on with my task.

        Comment

        Working...
        X