gcc - static pointer initialization problem

Alan Cooley alan@vacooley.com
Thu Aug 7 21:01:00 GMT 2003


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


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: gccversion.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030807/9417b536/attachment.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Makefile
Type: application/octet-stream
Size: 336 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030807/9417b536/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static_function_ptr_def.h
Type: application/octet-stream
Size: 202 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030807/9417b536/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static_function_ptr_def.c
Type: application/octet-stream
Size: 132 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030807/9417b536/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: static_function_ptr.c
Type: application/octet-stream
Size: 280 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030807/9417b536/attachment-0003.obj>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list