|
|
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.)
| |
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.chops@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.ohops@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: |
|
| Next: |
|
| ||||||||