Jump to content

  • Log In with Google      Sign In   
  • Create Account


Linking two static libraries that have the same symbols


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 staticVoid2   Members   -  Reputation: 265

Like
0Likes
Like

Posted 03 October 2013 - 06:39 AM

I need to be able to use functionality from two static libraries which have been built under different build configurations. This is for backwards compatibility reasons. The problem is, during the linking process the library symbols conflict and the linker will just choose one over the other at random.

 

Is there anyway to get around this issue?

 

Thanks.



Sponsor:

#2 Bregma   Crossbones+   -  Reputation: 4850

Like
9Likes
Like

Posted 03 October 2013 - 08:21 AM

Short answer: no.

 

Longer answer: yes, if you're on a platform supporting weak symbols and one of the libraries has marked the symbol as weak and the other hasn't.

 

Final answer:  this is an old, old problem.  The language-level workaround is to properly namespace symbols.  The linker-level workaround is either weak symbols or linker maps or both.  The simple solution is to have access to the source and fix it.


Stephen M. Webb
Professional Free Software Developer

#3 achild   Crossbones+   -  Reputation: 1631

Like
0Likes
Like

Posted 03 October 2013 - 08:56 AM

Yeah... there aren't a lot of options there. Do they have to be statically linked?



#4 swiftcoder   Senior Moderators   -  Reputation: 9762

Like
3Likes
Like

Posted 03 October 2013 - 11:19 AM

Last ditch hack, if Bregma's suggestions are not usable: statically link one of the libraries to a dynamically linked wrapper library which aliases the offending symbols.


Tristam MacDonald - Software Engineer @Amazon - [swiftcoding]





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS