(Answer) (Category) SCO comp.unix.sco.programmer FAQ. : (Category) SCO Development Environments. :
Where is alloca()?
Add -lPW to your link line to get alloca()
robertlipe@usa.net
Note that for UDK C++, alloca() is not supported.

(This is because it is incompatible with an efficient exception handling implementation. Note that better alternatives to alloca() exist in C++, such as the vector class in the draft standard library or the Block class in UDK Standard Components.)
jls@sco.com

If you really need an alloca() to build something and are willing to
live with the above and can't find one anywhere else 
many of the gnu software sources include one.

bash-1.14.6/lib/malloc/alloca.c
bash-1.14.6/lib/malloclib/alloca.c
bash-2.0/lib/malloc/alloca.c 
diff-2.6/alloca.c
diffutils-2.7/alloca.c 
fileutils-3.16/lib/alloca.o
find-3.6/lib/alloca.c
findutils-4.1/lib/alloca.c
gawk/gawk-3.0.3/alloca.c
make-3.75/alloca
readline/alloca.c 
sed-2.05/alloca.c
tar-1.12/lib/alloca.c
hops@sco.com
Heres an asm version (from lxrun) 
alloca.s
        .text
        .globl  alloca
        .align  4
alloca:
        popl    %edx            / return address
        popl    %eax            / nbytes
        movl    %esp,%ecx
        subl    %eax,%esp       / calculate new esp
        andl    $-4,%esp        / make sure stack is 4 byte aligned
        movl    %esp,%eax       / return pointer to new memory in eax
        pushl   8(%ecx)         / copy saved registers 
        pushl   4(%ecx)
        pushl   0(%ecx)
        pushl   %ecx            / we need to push a fake argument here
                                / since alloca's caller will attempt to
                                / clean up the stack

        jmp     *%edx           / return

It'll build on Osr5 and UW7 with a simple Makefile rule referring to 
alloca.o
hops@sco.com
In the UDK and in UW7, there is an intrinsic version of alloca() built into the compiler. It is enabled via -Kalloca.
dfp@sco.com
The UDK C++ compiler does now support -Kalloca as well. I think this change was made as of UW 7.1.0 or thereabouts.
jls@sco.com
[Append to This Answer]
Previous: (Answer) How can I detect null references in my program?
Next: (Answer) Purify or other malloc checkers.
This document is: http://www.zenez.com/cgi-bin/scoprogfaq/faq?file=15
[Search] [Appearance]
This is a Faq-O-Matic 2.721.