Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / December 2005



Tip: Looking for answers? Try searching our database.

Xcode linker symbol polution with a Framework

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Miller - 05 Dec 2005 15:52 GMT
I am building a plugin for a product with Xcode. In my code is a source
file with some symbols in it, which I link with into my bundle. I also
link with some Frameworks from the host application. One of those
Frameworks also happens to have the same symbols that I am linking with
into my bundle. When run, it seems my code ends up getting the
Framework's symbols instead of from the .o I am linking directly with.

On UNIX, this would normally be solved with some fun use of the
-Bsymbolic flag. Is something like this available in Xcode?
Eric Albert - 05 Dec 2005 17:45 GMT
> I am building a plugin for a product with Xcode. In my code is a source
> file with some symbols in it, which I link with into my bundle. I also
> link with some Frameworks from the host application. One of those
> Frameworks also happens to have the same symbols that I am linking with
> into my bundle. When run, it seems my code ends up getting the
> Framework's symbols instead of from the .o I am linking directly with.

It sounds like you don't want to export those symbols from your
framework (or from your bundle).  Is that right?  If so, change your
exports to reflect that and I'm pretty sure this'll work.

Hope this helps,
Eric

Signature

Eric Albert         ejalbert@cs.stanford.edu
http://outofcheese.org/

Paul Miller - 05 Dec 2005 19:20 GMT
>>I am building a plugin for a product with Xcode. In my code is a source
>>file with some symbols in it, which I link with into my bundle. I also
[quoted text clipped - 6 lines]
> framework (or from your bundle).  Is that right?  If so, change your
> exports to reflect that and I'm pretty sure this'll work.

Unfortunately, I don't have any control over the Framework. Even though
I don't export the symbol from my bundle, it still seems to be getting
it from the Framework.

The only work-around I have found is to put the offending code into a
shared library and load it dynamically at runtime.

> Hope this helps,
> Eric
l0ne (on mac) - 06 Dec 2005 11:01 GMT
> In my code is a source
> file with some symbols in it, which I link with into my bundle.

As this is a plugin, you most likely don't want to export additional
symbols; you could mark the private portions of your plugin as static or
__private_extern__, or simply change their name (prefixing it,
a-la-NSWhatever, seems a good idea).

- ∞
Paul Miller - 08 Dec 2005 16:59 GMT
>>In my code is a source
>>file with some symbols in it, which I link with into my bundle.
[quoted text clipped - 3 lines]
> __private_extern__, or simply change their name (prefixing it,
> a-la-NSWhatever, seems a good idea).

I wish I could, but one of the object files is from a third-party which
declares a public function pointer, which then gets accessed by a
third-party static library I am also linking with. The problem is when
my bundle gets linked into the main app, the function pointer ends up
pointing to the one in the host app's framework, rather than the one
bound in my code as a .o file. I don't understand why my .o doesn't have
a higher precedence than the Framework.

I've worked around it for now by locating the offending code in a shared
library that I load dynamically at runtime. Not pretty though.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.