This is the mail archive of the cygwin-developers@sourceware.cygnus.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]

Cygwin compiler problem.


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();


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