• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Preventing name mangling of exported symbols in a c++ file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preventing name mangling of exported symbols in a c++ file


  • Subject: Re: Preventing name mangling of exported symbols in a c++ file
  • From: Steve Checkoway <email@hidden>
  • Date: Wed, 4 Jan 2006 09:53:34 -0800


On Jan 4, 2006, at 1:44 AM, Matt Gough wrote:


However, this leads me on to another problem that CodeWarrior doesn't have:


My framework needs to use a few source files from a large source library (PowerPlant as it happens). The few files that it uses can call functions in other source files. However none of the functions I am using would result in any of these other functions being called. As such, in CW I do not need to add the unneeded source files to my project. Unfortunately this does not seem to be the case with Xcode. The linker is complaining about Undefined symbols that are not needed. It should know they are not needed as they are not in my Exported Symbols file. The simple solution would seem to be to add the source files containing the undefined symbols (there are only 5 such symbols). Unfortunately this does not work as the problem then ripples along to all of the functions that that those files call that are in other files not yet added to the project.

If I understand what you mean, then I would suggest just ripping the functions you need out and putting them in a separate file.

Is there some linker settings I can use that will alleviate this, or do I really need to add this ever expanding chain of unneeded files to my project?

You could try adding -dead_strip. It seemed to work for my simple test:

$ cat foo.c
extern void foo();
static void bar() { foo(); }
int main() { return 0; }
$ gcc foo.c
/usr/bin/ld: Undefined symbols:
_foo
collect2: ld returned 1 exit status
$ gcc -dead_strip foo.c


I could just define some stub versions of these functions, but that might lead to future problems if ever the real versions were needed.

One idea if you do decide to stub them to ensure that they are never called would be to abort() in each of the stubs.


- Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Preventing name mangling of exported symbols in a c++ file (From: Matt Gough <email@hidden>)
 >Re: Preventing name mangling of exported symbols in a c++ file (From: Eric Albert <email@hidden>)
 >Re: Preventing name mangling of exported symbols in a c++ file (From: Steve Checkoway <email@hidden>)
 >Re: Preventing name mangling of exported symbols in a c++ file (From: Matt Gough <email@hidden>)

  • Prev by Date: Re: Relative paths for headers
  • Next by Date: RE: Relative paths for headers
  • Previous by thread: Re: Preventing name mangling of exported symbols in a c++ file
  • Next by thread: Localization and Build Configurations
  • Index(es):
    • Date
    • Thread