This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Automatically initialize all global variables/arrays in GCC.
- From: "Kevin Hung" <cykhung at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 5 Jul 2007 13:20:47 -0700
- Subject: Automatically initialize all global variables/arrays in GCC.
I am using gcc to compile our C code under Linux. After compiling and
linking, we use SWIG to create python wrapper for the C code so that
we can execute C functions in python.
My question is: When our C program gets loaded into python, is it
possible to have all global variables/arrays in our C code to be
initialized to some magic constants (say all ones)? I think if this is
possible, it would be a linker option under GCC. My gcc version is:
gcc version 3.3.5 (Debian 1:3.3.5-12)
I have looked through the online manual for gcc but could not find
anything that is related to my problem. Actually I am not 100% sure
whether this is done by the compiler or SWIG.
Thanks.