You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
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?
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).
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...
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.
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Comment