Announcement

Collapse
No announcement yet.

Error 410 "Literals exceed 64K"

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

  • Error 410 "Literals exceed 64K"

    I use a large DATA statments in my program.. Thay keep growing all the time.. Now thay are so large that I am getting Error 410 "Literals exceed 64K" what is this and how can I get rid of the error?

    ------------------
    Bobby Gage II

  • #2
    It means pretty much what it says: there is a limit of 64K total characters allowed for DATA statments.

    There are a couple of workarounds:

    First, you can store the literals in a file and load them at runtime.

    Alternately (and this is esoteric), you can store them in an OBJ file and $LINK them into your program, accessing them with CODEPTR and offsets.
    By the time you get done with this method, you will wish you had taken the "file" road. (But this method is great for non-printable data when you don;t want to supply an external file).


    MCM
    Michael Mattias
    Tal Systems Inc. (retired)
    Racine WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      If your data is primarily text, you may find it worthwhile to employ simple compression techniques. This won't let the data grow indefinitely, of course. However, it would give you a bit more room, and would tend to encrypt the text, which may be of some benefit also.

      A simple compression scheme based on run-length encoding and on removing spaces can easily make text 15% smaller with no noticeable overhead in speed or code size, while still leaving the text in a printable format compatible with DATA statements. Assuming that you don't already use character codes above 127, a favorite technique is to set the high bit for a character to indicate that it should be followed by a space. Since your text data is not going to contain control codes, this would also leave you with a range of unique values for use as flags to indicate the start of other forms of compression, like run-length encoding...

      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        Thanks for all your help.. I was using the DATA staples to enbed files in my program. When the program started it would make the file as a tempory file so the file I needed was only one file not several.

        I decided to remove the DATA statments and replace them with a much simpler method of using:

        Print #FileNum%, Chr$(**data**,**data**,**data**)

        or for text

        Print #FileNum%, "**text**"

        And use this to bild my tempory files. It works good now and no error messages... I don't know if it made my program larger or not but it does not bother me. The size for this program does not matter and neather does speed.

        Thanks for all your help.

        ------------------
        Bobby Gage II

        Comment


        • #5
          Oops...forgot to mention... the characters in in-line literals as in..

          Code:
          PRINT "This is an in-line literal"
          ..also count against your 64K limit.

          MCM


          Michael Mattias
          Tal Systems Inc. (retired)
          Racine WI USA
          [email protected]
          http://www.talsystems.com

          Comment

          Working...
          X