Cygwin gcc "initializer element is not constant" problem
Jason Tishler
jason@tishler.net
Thu Jan 2 16:28:00 GMT 2003
The attached code snippet, j2.c, demonstrates a Cygwin specific
compilation problem that affects many Python shared extension modules:
$ gcc -c j2.c
j2.c:17: initializer element is not constant
j2.c:17: (near initialization for `f.get')
It appears that Cygwin gcc considers function pointers marked
"__declspec(dllimport)" unacceptable to use as initializer constants.
My standard workaround is to submit a patch that is the equivalent of
compiling this snippet with -DWORKAROUND:
$ gcc -DWORKAROUND -c j2.c
Unfortunately, this style of patch is no longer acceptable:
http://mail.python.org/pipermail/python-dev/2002-December/031534.html
Can anyone suggest a better (hopefully less intrusive) workaround?
Thanks,
Jason
--
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6
-------------- next part --------------
typedef void (*function)();
struct foo
{
function get;
};
__declspec(dllimport) void f1();
struct foo f =
{
#ifndef WORKAROUND
f1
#else
0
#endif
};
void
init()
{
#ifdef WORKAROUND
f.get = f1;
#endif
}
-------------- next part --------------
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
More information about the Cygwin
mailing list