<div class="gmail_quote">On Wed, Dec 1, 2010 at 7:14 PM, Mike Parker <span dir="ltr"><<a href="mailto:aldacron@gmail.com">aldacron@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On 12/2/2010 6:12 AM, Andrew Wiley wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
<br>
<br>
On Wed, Dec 1, 2010 at 2:36 PM, bearophile <<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a><br></div><div><div></div><div class="h5">
<mailto:<a href="mailto:bearophileHUGS@lycos.com" target="_blank">bearophileHUGS@lycos.com</a>>> wrote:<br>
<br>
    Franciszek Czekala:<br>
<br>
     > How do you set the stack size for D programs?<br>
<br>
    On Windows with DMD this is how to set the max stack size to about<br>
    1.5 GB of the "test.d" module:<br>
    dmd -L/STACK:1500000000 test.d<br>
<br>
    (I'd like D to have a standard syntax (maybe a pragma(...)) to tell<br>
    the other parts of the compilation chain how much stack to use).<br>
<br>
<br></div></div><div class="im">
If the stack size is only set by the executable on Windows, I don't see<br>
how that would be useful.<br>
<br>
</div></blockquote>
<br>
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<br>

<br>
dmd -L--stack 1500000000 test.d<br>
</blockquote></div><div><br></div><div>$ ld --stack</div><div>ld: unrecognized option '--stack'</div><div>ld: use the --help option for usage information</div><div><br></div><div>The linker doesn't set the stack size on Linux/Unix (seems like OSX is an exception). You set the stack size in the environment with '<span class="Apple-style-span" style="border-collapse: collapse; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; line-height: 18px; white-space: pre; "><span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; ">ulimit </span><span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 14px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; ">-s'</span></span></div>