1

I'm trying to find the way to fill .data section with c compiler: what if I have 1500 values, calculated with long and complicated algorhythm, and because the values are constant, I would like to store them in ".data" section of an executable.

So, the usual way to do it, is to have an .h file with this 1500 numbers. This means I have to create an .h file first with some script.

And the question is: can do it with C compiler only? Using code like that, or something:

static const int a[50];
for (int i = 0; i < 50; i++) a[i] = i;

int main() {...}

P.S. With CPP it is made like that(thanks to Anton Gilin): http://coliru.stacked-crooked.com/a/2938c6a9a1c47676 (it compiles only with later GCC), but I hate CPP.

Thanks!

Алр
  • 11
  • 3

0 Answers0