Is there a way to set the stacksize from within a process? I need a way to set the stacksize other than stack cookie, because I need it to be set from within a shared object (adding a stack cookie to the shared object doesn't work). I have tried
IDOS->System("stack 2000000", TAG_DONE);
but it doesn't seem to work. Help!
@alfkil
The function you want is NewStackRun(). It is detailed in the exec.library autodoc.
@alfkil
LOL! Do you know what you've done?
You've spawned a shell process to run the Stack command. So all the Stack command will do is set the stack for that shell process and then return to you. :-)
@salass00:
How am I supposed to use this one? What I want is to run _the same_ process in a larger stack frame, not a new process/function/whatever...
@alfkil
You are completely unable to read autodocs?
You can't just change the stack in the middle of a C program and then expect it to run to the end without crashing on AmigaOS as this would require in place resizing of the stack memory which is impossible in a shared memory system and with limited (32-bit) memory space.
Not even the stack command that you tried at first really does this. What the stack command just does is it changes the amount of stack that is used for programs run from the console in question (this fact can be confirmed quite easily by using Ranger).
@alfkil
I agree. You simply want a new stack, not to call a complicated routine needing register setup. You could try it with a main() procedure in your object I suppose.
But, I wonder, would StackSwap() do what you need? There isn't much info in the API about it and they really need quick examples in the AutoDocs.
This was so much easier in the 68K days. For example, AmigaE compiled programs swap the stack first thing. By allocating RAM and swapping it to A7. I thought that E programs would break instantly on OS4 because of this but they run perfectly fine! :-)