This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

re: __declspec(selectany)


Boaz Harrosh (boaz@hishome.net) wrote:
background:
I have managed to compile ATL/WTL from MSVC6.
I will have available a public patch-file for patching ATL/WTL to compile under wine, Once I have every thing running


Question:
All symbols and functions declared __declspec(selectany) show up as "duplicate symbols" errors on the linker. Eliminating it has the same results.


I have searched in google and the few lines I found is that GCC will accept __declspec(selectany) if "-fms-extensions" is used. Well it will accept it but will only ignore it all together.

Does any body know how to properly merge duplicate definitions of symbols in GCC?

Yes, I think it's attribute((weak)).


(before I go and change the code) maybe a command line switch to the compiler or linker can do the trick ?

Part of the solution might be to apply the following patch to the gcc-3.3 source tree:

Index: linux.h
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/config/i386/linux.h,v
retrieving revision 1.42
diff -u -d -u -r1.42 linux.h
--- linux.h	15 Nov 2002 14:57:12 -0000	1.42
+++ linux.h	5 Aug 2003 21:33:39 -0000
@@ -82,6 +82,14 @@
 	builtin_define ("__ELF__");		\
 	builtin_define ("__gnu_linux__");	\
 	builtin_assert ("system=posix");	\
+	builtin_define ("__stdcall=__attribute__((__stdcall__))");	\
+	builtin_define ("__cdecl=__attribute__((__cdecl__))");		\
+	builtin_define ("__declspec(x)=__attribute__((x))");		\
+	if (!flag_iso)							\
+	  {								\
+	    builtin_define ("_stdcall=__attribute__((__stdcall__))");	\
+	    builtin_define ("_cdecl=__attribute__((__cdecl__))");	\
+	  }								\
 	if (flag_pic)				\
 	  {					\
 	    builtin_define ("__PIC__");		\

but I'm sure more is needed; I haven't tested this at all.
(gcc/doc/extend.texi would need updating, too, at least,
and maybe whatever code implements -fms-extensions.)
I suspect the folks who did the original ms-extensions for gcc never
figured we'd be compiling Windows source code on Linux, but here we are...
- Dan

--
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045


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