Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!mcgill-vision!snorkelwacker!apple!mips!pacbell.com!decwrl!nsc!pyramid!cbmvax!kevin From: kevin@cbmvax.commodore.com (Kevin Klop) Newsgroups: comp.sys.amiga.tech Subject: Re: stack setting? Message-ID: <13009@cbmvax.commodore.com> Date: 3 Jul 90 03:51:28 GMT References: <13580002@hpspdra.HP.COM> Reply-To: kevin@cbmvax (Kevin Klop) Organization: Commodore, West Chester, PA Lines: 54 In article <13580002@hpspdra.HP.COM> ric@hpspdra.HP.COM (Ric Peregrino) writes: >I have ported a wave editor program to the amiga and found that the >default stack of 4000 is too small. I tried using a system call in >the program to automatically set the stack, but it seems to fail. >Anybody know why this is, or how it can be done? > >#include >#include > >void main(void) { > >printf("setting stack to 8192\n"); >system("stack 8192"); >system("stack"); >} > >the second call to stack with no argument returns the current stack >size: 4000. > >Thanks for any help, >ric@hpspd the ``stack'' command basically means: set the stack size for this process and all children processes to x. the system() call means: start a new process and have it execute the following command. Thus, system("stack 8192"); means start a new process, change that process' stack size to 8192, then exit that process. Note that this does NOT affect the stack size of the process ISSUING the system() call. You are pretty much limited to setting the stack size to whatever you wish BEFORE you run the program, OR setting up your own private stack inside the program (basically, allocating a large chunk of memory, pointing A7 at it, and then moving A7 back to its original position before exiting). -- Kevin -- Kevin Klop {uunet|rutgers|amiga}!cbmvax!kevin Commodore-Amiga, Inc. ``Be excellent to each other.'' - Bill and Ted's most excellent adventure Disclaimer: _I_ don't know what I said, much less my employer.