This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin gcc "initializer element is not constant" problem


On Thu, 2 Jan 2003, Jason Tishler wrote:

> 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

Jason,

I believe the complaint was not about the intrusiveness (i.e. patch size)
of the workaround, but about the readability of the resulting code.

How about doing exactly what the message suggests (see attached)?
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha@cs.nyu.edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor@watson.ibm.com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk!
  -- /usr/games/fortune

Attachment: j2-modified.c
Description: Text document

--
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/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]