Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Thu, 02 Jan 2003 11:30:09 -0500 From: Jason Tishler Subject: Cygwin gcc "initializer element is not constant" problem To: Cygwin Mail-followup-to: Cygwin Message-id: <20030102163008.GF1524@tishler.net> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_SaDdXNl29QRKLrUMrAEssQ)" User-Agent: Mutt/1.4i --Boundary_(ID_SaDdXNl29QRKLrUMrAEssQ) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline 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 --Boundary_(ID_SaDdXNl29QRKLrUMrAEssQ) Content-type: text/plain; charset=us-ascii; NAME=j2.c Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=j2.c 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 } --Boundary_(ID_SaDdXNl29QRKLrUMrAEssQ) Content-Type: text/plain; charset=us-ascii -- 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/ --Boundary_(ID_SaDdXNl29QRKLrUMrAEssQ)--