Increase Stack Size on Windows (GCC)

后端 未结 4 684
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-28 15:20

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

相关标签:
4条回答
  • 2020-11-28 15:39

    You could run editbin after linking.

    0 讨论(0)
  • 2020-11-28 15:43

    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.

    0 讨论(0)
  • 2020-11-28 15:50

    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.

    0 讨论(0)
  • 2020-11-28 16:03

    When creating threads you use the dwStackSize paremater, but I'm not sure how to change the size for the main thread, this indicates its in the exe's header, so it may be an option for the compiler/linker, else you need to find the relevant part of the header and change it yourself.

    http://msdn.microsoft.com/en-us/library/ms686774(VS.85).aspx

    0 讨论(0)
提交回复
热议问题