delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2000/07/05/21:37:34

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-developers-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-developers-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin-developers AT sourceware DOT cygnus DOT com
Date: Wed, 5 Jul 2000 18:37:22 -0700 (PDT)
From: Mo DeJong <mdejong AT cygnus DOT com>
To: cygwin-developers AT sourceware DOT cygnus DOT com
Subject: Cygwin compiler problem.
Message-ID: <Pine.SOL.3.91.1000705183635.5672O@cse.cygnus.com>
MIME-Version: 1.0

Hi all.

I am stumped in this one, could someone tell my why the
__attribute__(( dllimport )) causes this compile to fail?

thanks
Mo DeJong
Red Hat Inc


Results

% gcc -c structinit.c

% i586-cygwin32-gcc -c structinit.c
structinit.c:19: initializer element for `DD.getDrawable' is not constant

% i386-mingw32msvc-gcc -c structinit.c
structinit.c:19: initializer element is not constant
structinit.c:19: (near initialization for `DD.getDrawable')


/* file structinit.c */
typedef void (GetDrawableProc)  (void);

#if defined(__MINGW32__) || defined(__CYGWIN__)
extern __attribute__(( dllimport )) GetDrawableProc GetDrawable;
#else
extern GetDrawableProc GetDrawable;
#endif

typedef struct TkGS_DeviceDriver {
    char *name;         /* Name of device driver */

    GetDrawableProc         *getDrawable;
} DeviceDriver;


DeviceDriver DD = {
    "Canvas",
    GetDrawable
};

void main();

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019