Re: Errors linking against libLLVMCore
Re: Errors linking against libLLVMCore
- Subject: Re: Errors linking against libLLVMCore
- From: Rick Mann <email@hidden>
- Date: Fri, 28 Dec 2012 19:39:47 -0800
I tried reproducing the situation with a simple testlib.a, my testLib.dylib, and a test app that links against the latter. Everything links fine. I can't figure out how to fix this.
On Dec 26, 2012, at 9:17 , Glenn L. Austin <email@hidden> wrote:
>
> On Dec 26, 2012, at 1:26 AM, Rick Mann <email@hidden> wrote:
>
>>
>> On Dec 26, 2012, at 0:48 , "Glenn L. Austin" <email@hidden> wrote:
>>
>>> With STL, it's rare that you'll be missing a library -- it's FAR more likely that you're not including the proper header (stringfwd instead of string, for example).
>>
>>
>> Well, this is coming from LLVM, which I built without problem or modification right out of the box. I'm just linking against its libraries (static libraries).
>
>
> The compiler will automatically create the proper template instantiation of the specified STL class at compile-time, and if it can't do that it will simply create an external reference that needs to be resolved later (like other "normal" symbols).
>
> The problem is that, with STL, those symbols don't exist in a library until you've instantiated them at least once. Since the compiler does that for you when STL classes are defined, and those instantiations are generally local to the module (file) that is being compiled, they don't exist in any library file.
>
> If you use STL, think of C++ templates as just instructions to the compiler to write code for you (which, essentially, it is doing) with the specified types defined when needed. A template class doesn't actually exist until all of the types are defined for the usage, and then the compiler does the work of writing that code for you for that module. If the compiler doesn't have all of the instructions for writing that code -- such as when you use stringfwd instead of string -- then the compiler will fall back to its default behavior of assuming that the code will be elsewhere, and you'll get linker errors.
>
> --
> Glenn L. Austin, Computer Wizard and Race Car Driver <><
> <http://www.austin-soft.com>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
Rick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden