Hello, I am having a problem with a C program. It appears that static variables are not being initialized when in an object file. The program compiles and links fine but funcPtrStruct.ptr is null so program crashes.
This program works using gcc on Linux and (as I understand the C language) should work anywhere. Thanks in advance for any explanation/corrections you can provide. Alan. ---------------- Files attached: gccversion.txt - output of "gcc -v" Makefile - 'nuf said static_function_ptr_def.h - header for structure to hold function ptr static_function_ptr_def.c - implementation with static initializer static_function_ptr.c - main that invokes the function
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs Configured with: /netrel/src/gcc-3.2-3/configure --enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --without-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-version-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin Thread model: posix gcc version 3.2 20020927 (prerelease)
Makefile
Description: Binary data
static_function_ptr_def.h
Description: Binary data
static_function_ptr_def.c
Description: Binary data
static_function_ptr.c
Description: Binary data
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/