Boaz Harrosh wrote:
[Q] I'm (well ATL is) using __attribute__((weak)) (translated from __declspec( selectany) ) for instantiation of members and variables in headers. I had no problem with it On GCC in Linux (gcc 3.2.2). On MinGW
IMAGE_COMDAT_SELECT_ANY is not quite same as PECOFF version of "weak" , but AFAICT is equivalent to the GCC section flag ".linkonce discard". I don't think there is a way for the user to specify that for data using an attribute, but it could be done with asm statements.
.weak directive is partially supported in current binutils CVS. __attribute__((weak)) is not supported by GCC-3.4.x but will be in the next major GCC release (4.0.0).
The semantics of weak for PECOFF differ from that on Linux.See the PECOFF60 specs (Microsoft Portable Executable and Common Object File Format Specification) section on weak externals
Danny