How to compile GCC without _alloca?

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

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

But there is one problem: gcc always allocates a large array with _alloca,

and the VC linker cannot resolve the __alloca character.

eg,

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

this code calls the _alloca dependency, although I did not call the _alloca function explicitly.

(the size of the array matters. if I change 10240 -> 128, everything is fine)

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

Can gcc be used to use _alloca? (or adjust the threshold?)

+5
source share
4 answers

V++. ..

mingw gcc cygwin. , V++, cygwin. , V++ __chkstk __alloca.

+7

_alloca . gcc, , .

+3

, _ alloca Microsoft VS2005. _ malloca.

Your options do not look very good. Instead, you can try building VS2005. Perhaps cygwin has an option where you can say that you are using a newer runtime library (and if they do not yet support this, you can write it as a function request).

+1
source

All Articles