Is there a way to increase the stack size of a Windows application at compile/link time with GCC?


Solution 1:

IIRC, In GCC you can provide the --stack,[bytes] parameter to ld.

E.g.

gcc -Wl,--stack,16777216 -o file.exe file.c

To have a stack of 16MiB, I think that the default size is 8MiB.

Solution 2:

You could run editbin after linking.

Solution 3:

There are two stack sizes in Windows. The initially commited size, and the total reserved size. You can set both with a STACKSIZE statement in a .def file.