How to compile using gcc but without using _alloca ?

Posted by shkim on Stack Overflow See other posts from Stack Overflow or by shkim
Published on 2010-02-27T16:59:49Z Indexed on 2010/05/27 17:51 UTC
Read the original article Hit count: 141

Filed under:
|
|

For some reason, I should use gcc to compile a C file, then link against Visual C++ 2008 project.

(I used the current latest gcc version: cygwin gcc 4.3.4 20090804.)

But there is one problem: gcc always allocate a big array with _alloca,

and VC linker can't resolve the symbol __alloca.

for example,

int func()
{
    int big[10240];
    ....
}

this code makes the _alloca dependency although I didn't call the _alloca function explicitly.

(array size matters. if i change 10240 -> 128, everything ok)

I tried gcc option -fno-builtin-alloca or -fno-builtin, but no luck.

Is it possible to make gcc not to use _alloca ? (or adjust the threshold?)

© Stack Overflow or respective owner

Related posts about visual-c++

Related posts about gcc