[cfe-dev] Linker error and obfuscated name

Edward Diener eldlistmailingz at tropicsoft.com
Mon Aug 3 11:32:59 PDT 2015


On 8/3/2015 1:45 PM, Reid Kleckner wrote:
> On Mon, Aug 3, 2015 at 9:56 AM, Edward Diener
> <eldlistmailingz at tropicsoft.com
> <mailto:eldlistmailingz at tropicsoft.com>> wrote:
>
>     // ex_exception.hpp
>
>     #ifndef EX_EXCEPTION_HPP
>     #define EX_EXCEPTION_HPP
>     #include <exception>
>     #include "ex_decl.hpp"
>     class EX_VISIBLE ex_exception :
>
>
> I think this class should probably be dllexported. It's possible that
> mingw looks at class visibility as well as dllexport attributes when
> deciding whether or not to expor tthe RTTI for classes, but I'm pretty
> sure clang doesn't. We could add that check for compatibility. Is there
> a compelling reason to not use dllexport on the entire class here?

This is a simple example of a much more complicated problem in the Boost 
serialization library and its source build on Windows. I had made 
changes to get mingw(-64)/gcc to build correctly but have run into this 
clang problem. In essence Boost serialization on Windows exports 
individual member functions rather than entire classes. I doubt I am 
going to get the author of the library to change this, but I will 
mention to him the clang limitation and maybe he can do it.

If you make the change in clang to allow individual member functions to 
be exported/imported for visible classes that would be much better  IMO. 
But past versions of clang on Windows still have this limitation 
vis-a-vis the Boost serialization library. I do not know if other Boost 
libraries which are non-header only use the same technique of 
exporting/importing individual member functions of visible classes on 
Windows. If they do then clang on Windows targeting mingw(-64)/gcc will 
not work with them either.

On Linux clang works fine of course, as does gcc, with Boost 
serialization source build. On Linux the individual exporting/importing 
of member functions is not used ( I don't even know if it is possible on 
Linux ).

>
>          public virtual std::exception
>     {
>     private:
>          char m_buffer[128];
>     protected:
>          EX_DECL unsigned int append(unsigned int l, const char * a);
>          EX_DECL ex_exception() ;
>     public:
>          typedef enum {
>            no_exception,
>            other_exception
>          } ex_exception_code;
>          ex_exception_code code;
>          EX_DECL ex_exception(ex_exception_code c,const char * e1 =
>     0,const char * e2 = 0) ;
>          EX_DECL ex_exception(ex_exception const &) ;
>          virtual EX_DECL ~ex_exception() throw() ;
>          virtual EX_DECL const char * what() const throw() ;
>     };
>     #endif // EX_EXCEPTION_HPP





More information about the cfe-dev mailing list