Forum > Beginners
Can't read COFF Header...
kazhar:
Hello, i am not exactly a beginner, but this feels to me like a real noob-problem...
I have a quite large unit containing a vast array of qWords:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit xyzList; {$mode objfpc}{$H+}interfaceconst KnownList: array[0..322244336] of qWord = (// < --- here go all the numbers --- >); implementationend.
This unit is generated by an export program to be used as part of a quick&dirty testing and integrity check routine. Worked well while the array was smaller, but now the compiler throws this error:
Projekt kompilieren, Ziel: CheckResFile.exe: Exit code 1, Fehler: 1
Error: Can't read COFF Header while reading C:\Users\<user>\Documents\SourceCode\CheckResFile\lib\x86_64-win64\xyzList.o
xyzList.pas is about 3,7 GB large and has about 10,7 million lines. Is there a way to compile that monster succesfully? It also dont help, that the IDE wont display that file...
thanks!
440bx:
I am not absolutely sure of this but, I believe that a single array in FPC is limited to 2GB and your array exceeds that.
Thaddy:
--- Quote from: 440bx on August 05, 2018, 08:34:05 pm ---I am not absolutely sure of this but, I believe that a single array in FPC is limited to 2GB and your array exceeds that.
--- End quote ---
Depends on platform. As in Delphi or C++. The limit you refer to is 32 bit platform (D7 Windows32?) and not even all of them..
And pointers for 32 bit code are unsigned in FPC, so double the amount.
He needs to mention Platform and Bitness, as usual. And the fpc version.
This can be solved in at least two ways: 64 bit: buy more memory. 32 bit: e.g. use a file and a buffered stream.
engkin:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---//ogcoff.pas function TCoffObjInput.ReadObjData(AReader:TObjectreader;out objdata:TObjData):boolean;... { Read COFF header } if not AReader.read(header,sizeof(tcoffheader)) then begin InputError('Can''t read COFF Header'); exit; end;
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---//owbase.pasfunction tobjectreader.read(out b;len:longint):boolean;begin result:=true; if bufidx+len>bufmax then begin result:=false; len:=bufmax-bufidx; end; move(buf[bufidx],b,len); inc(bufidx,len);end;
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---//owbase.pasfunction tobjectreader.openfile(const fn:string):boolean;... bufmax:=f.Size;
bufmax and property Size are of type Longint (4 bytes).
kazhar:
thanks for your replies!
target platform is win64. the compiler runs on win7 64bit with 16GB or RAM.
Navigation
[0] Message Index
[#] Next page