Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to make my programme use my own stack?

I have written few functions in my programme.

from main i make a call to a function, this function will then call another and so on.

now when i make a call to a function from my main, i want that function to use it's own stack and execute within that.

how do i achieve this?

i am using setjmp and longjmp in other functions to jump between function.

regards
Girish

Comments

  • stoberstober Member Posts: 9,765 ✭✭✭
    : I have written few functions in my programme.
    :
    : from main i make a call to a function, this function will then call another and so on.
    :
    : now when i make a call to a function from my main, i want that function to use it's own stack and execute within that.
    :
    : how do i achieve this?
    :
    : i am using setjmp and longjmp in other functions to jump between function.
    :
    : regards
    : Girish
    :
    [blue]If you are using setjmp and longjmp(), then it is not possible for your program to swap stacks. You would normally not want to do that in an application program anyway. Each function does use its own private section of the program's stack, so that function B() does not see the stuff that is on function A() section of the stack. Normally the only time a program would swap stacks is at the beginning of an interrupt function, in this case the interrupt function will swap the stack to insure there is sufficient stack space in which to run, then swap it back again before leaving the function.[/blue]

Sign In or Register to comment.