testcase
test.cpp
#ifdef FOOBAR
#define ATTRIBUTE __attribute__ ((dllexport))
#else
#define ATTRIBUTE __attribute__ ((visibility ("default")))
#endif
 class ATTRIBUTE Sa {
        public:
 Sa()
 {}
 ~Sa();
};
ATTRIBUTE Sa::~Sa()
{return;}

 bool DllMain(void *a,void*b,int)
 {
Sa s;
return true;
}

--
test2.cpp
class __attribute__((dllimport)) Sa {
 public:
 Sa()
 {}
__attribute__((dllimport)) ~Sa();
};

Sa a;
 bool DllMain(void *a,void*b,int)
 {
Sa s;
return true;
}


the following are directives that gcc emit when given attribute is
__attribute__ ((dllexport))
surely it must emit _ZN2SaD1Ev symbol or linker cannot find this symbol.

        .section .drectve
        .ascii " -export:_ZN2SaD2Ev"
        .ascii " -export:_ZN2SaC1Ev"
        .ascii " -export:_ZN2SaC2Ev"

for now i workaround this using __attribute__ ((visibility ("default")))


-- 
           Summary: [4.5 regression] __attribute__ ((dllexport)) produces
                    broken linkage
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jojelino at gmail dot com
 GCC build triplet: i686-pc-cygwin
  GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42870

Reply via email to