Board index » cppbuilder » Why this error? "[Linker Error] Fatal: Access violation. Link terminated."

Why this error? "[Linker Error] Fatal: Access violation. Link terminated."


2005-06-16 08:13:19 AM
cppbuilder25
Hi guys,
I did something simple below. Just declared a global double
array of 4 million entries (4,000,000) and i get a linker error:
"[Linker Error] Fatal: Access violation. Link terminated."
double x[4000000] =~ 32Mb Is that too big? Is that the reason?
it was fine with 3million entries.
I changed the MAX stack size in BCB ((Project->Options->Linker)
to 0x01000000 which is max 16Mb. Does this even matter. It
doesn't make sense since the project didn't crash when I tried
3 million entries. So, maybe that is not the deal.
What settings do I need to change. I will appreciate your help.
here's the code.. basically one line.
//------------Unit1.cpp------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
double x[10000000]; //<<<<<<<< this line
//---------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//--------------------------
thanks,
Veebo
 
 

Re:Why this error? "[Linker Error] Fatal: Access violation. Link terminated."

Hi,
Quote
"[Linker Error] Fatal: Access violation. Link terminated."

double x[4000000] =~ 32Mb Is that too big? Is that the reason?

I don't think that is too big. I can get somthing similar only
if I have the .map file open in the Code Editor and the linker
option to generate Detailed Map file is ON. It is possible
though, to have too big global declaration in which the
case the linker should put out an error like "invalid exe,
program not loadable" or something like that, and the
linker does not handle that well if I remember. If you
have similar declarations in many modules you might
want to change to dynamic allocation.
--Craig