No announcement yet.

file_LoadFunction questions

  • Filter
  • Time
  • Show
Clear All
new posts

  • file_LoadFunction questions

    I am working on a complex problem and ran out of program space on my uLCD-43PCT_GFX2. In looking at the documentation I found file_LoadFunction and thought this would be an ideal way to load parts of the program at a time. I ran into some problems when I tried use it.

    I attempted to pass a global image pointer to a function loaded
    from a file and it did not work..
    The function is
    #platform "uLCD-43PCT_GFX2"
    func SimpleFunction(var imgPoint)
    img_Show(imgPoint, 4);
    gfx_MoveTo(0, 0);
    print("SimpleFunction called");

    It is being called using this code
    imgm := file_LoadImageControl("testtri.dat", "testtri.gci", 0);
    //this is actually else ware in the code but it is executed first
    var test;
    test := file_LoadFunction("Simple.4FN");
    print("load of Simple.4fn failed");
    endif; font-family: arial, sans-serif;" />
    The image is not shown but the text is printed. I would like an
    example of the correct code to accomplish this task.

    #inherit "file.fnc" seems to include the code at the top even if it is
    called at the bottom, making it impossible to use with files that you
    wish to compile as .4fn is it possible to do a positional #inherit so
    the code is placed where the #inherit is (like include in c)?

    Is it possible to have more than one function in a .4fn file
    (internally called)?

    Is there any way to prevent the compiler from optimizing out the
    unreferenced first function if there are multiple functions?

    Can you use global functions if you pass pointers to them?