Next: , Previous: stackextend implementation, Up: libstack.a


6.3.3 Using stack checking or extension

To utilize the stack checking or extension feature you need at least V2.7.0 of gcc. With this compiler you get 2 new amiga specific options that emit special code whenever necessary:

Always use those switches together with ‘-lstack’ to link with the stack extension code or you will get a lot of undefined references ;-). You can mix functions compiled with or without stack checking and extention without problems.

Caution:

Do not use stack checking and/or extension switches when compiling hook or interrupt code. Both run in alien contexts with a different stack and all stack magic must fail. Also don't try to do some other stack magic on your own if you want to use stack extension.

Also note that a program compiled with stack extension/checking may ‘exit()’ at any function entry or when using alloca or variable sized arrays. Either prepare your cleanup function accordingly (use ‘atexit()’) or don't use this feature.

If you like to write or call functions with more than 256 bytes of arguments (64 ints, longs or pointers) you should adjust the behaviour of the stack extension code (See Advanced.).