Boost logo

Boost Users :

Subject: Re: [Boost-users] [Exception] Duplicate symbol error when using errinfo_api_function in static library
From: Georg Leidinger (georg.leidinger_at_[hidden])
Date: 2013-10-03 02:32:34


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_at_[hidden]>

> On Wed, Oct 2, 2013 at 3:06 PM, Georg Leidinger <
> georg.leidinger_at_[hidden]> 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_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net