Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: solar_max on January 02, 2008, 02:18:09 am

Title: stack size
Post by: solar_max on January 02, 2008, 02:18:09 am
Hello,

I try to increase the reserved stack size of my output .exe ! I use Code::Blocks on Windows with the MingW compiler. Can I set a variable ?

Thanks for help !
Title: Re: stack size
Post by: thomas on January 02, 2008, 11:52:00 am
Code
D:\desktop>ld --help |grep stack
  --stack <size>                     Set size of the initial stack
Title: Re: stack size
Post by: solar_max on January 02, 2008, 10:19:40 pm
Thanks !

Ok for cmd line, but can I configure this in CodeBlocks ? It will be easier if I haven't to go through the cmd line before each run in CodeBlocks ...
Title: Re: stack size
Post by: Maciek on January 02, 2008, 10:55:55 pm
project->build options->linker settings->other linker options
Title: Re: stack size
Post by: TDragon on January 03, 2008, 06:10:22 am
project->build options->linker settings->other linker options
... and make sure to tack "-Wl," on the beginning -- i.e. "-Wl,--stack=1024", or whatever you choose for your stack size.
Title: Re: stack size
Post by: hokselato on May 13, 2012, 05:38:14 pm
Hi all,

Trying to increase stack size for example with "-Wl --stack,1024" from linker or compiler options in Code Block didn't work for me. Is anyone know solution of this problem by using IDE?

Thanks.
Title: Re: stack size
Post by: MortenMacFly on May 13, 2012, 08:58:38 pm
for example with "-Wl --stack,1024"
That is wrong. Instead of "-Wl --stack,1024", use "-Wl,--stack,1024" (notice the comma).
Title: Re: stack size
Post by: hokselato on May 14, 2012, 08:57:44 am
Thanks for reply,

Sorry for typo. I tried your suggestion but at compile time a blue warnings says unused linker option and end of compile this message disappears. This option is not working. Do you have any alternate advice to increase stack size? I will use my code at an embedded platform so I dont want to use malloc. All my memory allocations must be at stack.

My linker option is (and I also tried it  as compiler option)

-Wl,--stack,52800000

Compiler Warning is;

Compiling: FFT_anysize.c
mingw32-gcc.exe: --stack: linker input file unused because linking not done
mingw32-gcc.exe: 528000000: linker input file unused because linking not done

Thanks.
Title: Re: stack size
Post by: MortenMacFly on May 14, 2012, 09:51:27 am
Compiler Warning is;
Why don't you simply look up, for example here:
http://sourceware.org/binutils/docs-2.16/ld/Options.html
?
This is a Code::Blocks, not a compiler/linker related forum. You should better ask this question in a forum related to the compiler you are using, e.g. GCC mailing list. It may heavily depend on the platform and version you are using - and for such stuff, you should better ask compiler people, see here:
Quote
--stack reserve
--stack reserve,commit
    Specify the amount of memory to reserve (and optionally commit) to be used as stack for this program. The default is 2Mb reserved, 4K committed. [This option is specific to the i386 PE targeted port of the linker]
Title: Re: stack size
Post by: venom4u31 on October 01, 2013, 09:19:03 am
An advice for this action would be to also rebuild the program (Build->Rebuild).
I tried typing "-Wl --stack,1024" and after I have rebuilt the program, the stack size was indeed changed.
Title: Re: stack size
Post by: Raef Mohamed on February 05, 2021, 05:52:18 pm
Hello,
I am trying to increase the stack size
I write in the linker options "-Wl,--stack,2048" but I receive an error unrecognized option '--stack'
Could anyone help?.
Title: Re: stack size
Post by: oBFusCATed on February 05, 2021, 06:00:49 pm
1. Are you sure you're giving it to the linker. To verify inspect the full build log
2. Are you sure your linker supports it? To verify inspect the linker's documentation.
Title: Re: stack size
Post by: matthen on June 03, 2021, 06:11:58 pm
Hello,
I am trying to increase the stack size
I write in the linker options "-Wl,--stack,2048" but I receive an error unrecognized option '--stack'
Could anyone help?.

The string "-Wl,--stack=2048" worked for me. Also, I believe that the units are bytes, rather than megabytes, so it's probably sensible to add a few 0s. (Happy to be proven wrong)
Title: Re: stack size
Post by: benkenobi01 on June 04, 2021, 08:46:35 pm
Hello,
I am trying to increase the stack size
I write in the linker options "-Wl,--stack,2048" but I receive an error unrecognized option '--stack'
Could anyone help?.
Dude what's your problem?