| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| Date: | Thu, 9 Aug 2001 02:10:53 -0700 (PDT) |
| From: | Mo DeJong <mdejong AT cygnus DOT com> |
| To: | cygwin AT sources DOT redhat DOT com |
| Subject: | Why does this __declspec(dllimport) fail to compile? |
| Message-ID: | <Pine.SOL.3.91.1010809020327.22185F-100000@cse.cygnus.com> |
| MIME-Version: | 1.0 |
Hi.
I have run into a little problem with a static initializer
that seems to work just fine with VC++ but fails with gcc.
% cat callback.c
extern __declspec(dllimport)
void ExtCallback(void);
typedef void (callback) (void);
typedef struct Scallback {
callback*c1;
} Scallback;
static Scallback scall = {ExtCallback};
int main() {
callback*sc = scall.c1;
return (int) sc;
}
% gcc -c callback.c
callback.c:10: initializer element is not constant
callback.c:10: (near initialization for `scall.c1')
When this same code it compiled with VC++ it waits
until link time to figure out the function address.
Why does this fail with gcc?
P.S.
Other folks have mentioned this python FAQ but
it does not explain why gcc generates this error.
http://www.python.org/doc/FAQ.html#3.24
thanks
Mo DeJong
Red Hat Inc
--
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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |