I found this clang bug http://llvm.org/bugs/show_bug.cgi?id=10113 which seems to be related to the problem.


2013/10/3 Georg Leidinger <georg.leidinger@googlemail.com>
It happens only if the library is build with the LLVM 4.2 (I am using XCode so it is the Apple LLVM 4.2, I don't know if there is something different from the standard LLVM 4.2). If I choose the LLVM GCC 4.2 no errors are reported. Is this a bug in the LLVM compiler?

best
Georg Leidinger

2013/10/3 Emil Dotchevski <emildotchevski@gmail.com>
On Wed, Oct 2, 2013 at 3:06 PM, Georg Leidinger <georg.leidinger@googlemail.com> wrote:
Hi Emil,

I was able to figure out some more information about the issue and I could isolate it a little bit more. First it doesn't matter if it is a static or a shared library. Second it is not directly related to the Boost.Exception library but to the template class error_info which is used to create the predefined errinfo_xyz types. It is enough to instantiate the errinfo_api_function type in both doSomething() methods in the both implementation files. I am not so good in templates but I guess that the compiler creates the same symbol in both object files (ClassA.o and ClassB.o) for the type errinfo_api_function. I can see this via nm that I have the following line in both object files:

ClassA.o
0000000000059860 s __ZTIN5boost21errinfo_api_function_E

ClassB.o
0000000000059870 s __ZTIN5boost21errinfo_api_function_E 

Instantiating a template in two compilation units should not lead to link errors. That's why I can't understand why this happens.

--
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode

_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users