Dan Kegel dank at kegel.com
Tue Aug 5 23:12:33 CDT 2003

Fergus Henderson wrote:
> On 05-Aug-2003, Dan Kegel <dank at kegel.com> wrote:
>>Part of the solution might be to apply the following patch to the
>>gcc-3.3 source tree:
> Rather than patching gcc, an easier solution would be to put the
> corresponding #defines for _cdecl etc. in a header file called say
> "ms_extensions.h", and then compile with "gcc -include ms_extensions.h ..."
> so that these #defines get automatically included in every compilation unit.

Silly me.  For some reason I thought the builtin declarations were
magic.  Here's a little demo that might show the basic idea.
Does this do what you needed, Boaz?
- Dan

$ gcc -include msextensions.h foo.c bar.c
$ ./a.out
Value of x is 7

$ gcc -include msextensions.h bar.c foo.c
$ ./a.out
Value of x is 1

#define __declspec(x) __attribute__((x))
#define selectany weak

int __declspec(selectany) x = 7;

#include <stdio.h>

int __declspec(selectany) x = 1;

int main()
     printf("Value of x is %d\n", x);

Dan Kegel

More information about the wine-devel mailing list