This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __declspec(selectany)
Dimitrie O. Paun wrote:
On August 6, 2003 12:12 am, Dan Kegel wrote:
Silly me. For some reason I thought the builtin declarations were
magic. Here's a little demo that might show the basic idea.
winegcc already defines these things:
gcc_argv[i++] = "-D__stdcall=__attribute__((__stdcall__))";
gcc_argv[i++] = "-D__cdecl=__attribute__((__cdecl__))";
gcc_argv[i++] = "-D__fastcall=__attribute__((__fastcall__))";
gcc_argv[i++] = "-D_stdcall=__attribute__((__stdcall__))";
gcc_argv[i++] = "-D_cdecl=__attribute__((__cdecl__))";
gcc_argv[i++] = "-D_fastcall=__attribute__((__fastcall__))";
gcc_argv[i++] = "-D__declspec(x)=__attribute__((x))";
I looked at
http://cvs.winehq.com/cvsweb/wine/tools/winegcc.c?rev=1.16
and see you don't have
#define selectany weak
Without that, you get compilation errors on my demo (and presumably
on the original poster's source code):
[dank@krunch dank]$ gcc -include msextensions.h bar.c foo.c
bar.c:3: warning: `selectany' attribute directive ignored
foo.c:1: warning: `selectany' attribute directive ignored
/tmp/ccFjkSf7.o(.data+0x0): multiple definition of `x'
/tmp/ccDWXV71.o(.data+0x0): first defined here
collect2: ld returned 1 exit status
Think winegcc should do -Dselectany=weak?
- Dan
--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045