alloca and c++
Ingo Krabbe
i.krabbe@dokom.net
Fri Feb 1 14:53:00 GMT 2002
I don't know what's the problem (g++ --version = 2.95.3)
(see attached code)
declaring a function in C++ scrambles its internal name as you can see if you
call "nm" on the produced executable. You have to declare it in extern "C".
This is done automatically by #include <stdlib.h> .. so lets look there :
#if defined __USE_GNU || defined __USE_BSD || defined __USE_MISC
# include <alloca.h>
#endif /* Use GNU, BSD, or misc. */
alloca is included only if you use GNU,BSD or misc extensions.
How you do this you can read about in features.h
This is done, because the standard use of alloca is discouraged as you can
read on the manual page.
Of course it should work if you declare it by hand. This works only if you
use extern "C".
CU INGO
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.cc
Type: text/x-c
Size: 182 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20020201/91ac7e58/attachment.bin>
More information about the Gcc
mailing list