Setting the stack size

Mike Parker aldacron at gmail.com
Wed Dec 1 17:14:20 PST 2010


On 12/2/2010 6:12 AM, Andrew Wiley wrote:
>
>
> On Wed, Dec 1, 2010 at 2:36 PM, bearophile <bearophileHUGS at lycos.com
> <mailto:bearophileHUGS at lycos.com>> wrote:
>
>     Franciszek Czekala:
>
>      > How do you set the stack size for D programs?
>
>     On Windows with DMD this is how to set the max stack size to about
>     1.5 GB of the "test.d" module:
>     dmd -L/STACK:1500000000 test.d
>
>     (I'd like D to have a standard syntax (maybe a pragma(...)) to tell
>     the other parts of the compilation chain how much stack to use).
>
>
> If the stack size is only set by the executable on Windows, I don't see
> how that would be useful.
>

It's not set by DMD, but by the linker. You need to pass the appropriate 
flag to the linker on each platform via the -L command line option. 
bearophile's example is for OPTLINK. On platforms where DMD is backed by 
the gcc toolchain, you should be able to use

dmd -L--stack 1500000000 test.d


More information about the Digitalmars-d mailing list