Re: Question about static linking...
Re: Question about static linking...
- Subject: Re: Question about static linking...
- From: Rush Manbert <email@hidden>
- Date: Fri, 10 Mar 2006 16:30:01 -0800
Daniel Jalkut wrote:
<snip>
You might consider using Xcode's fairly new (as of 2.2) "Object File"
target kind, which allows you to package the compiled results of
several source files into a single ".o" which can be linked in by your
external client. This target type also respects export lists like a
static library, but doesn't postpone the internal symbol resolutions
like a library does.
Hi Daniel,
I have seen two recent postings where you were encouraging use of this
target type. I have a couple of questions that maybe you can answer.
I was under the impression that when you link against a static lib, the
granularity of code inclusion was the compilation unit. What I mean is
that if I have a file called foobar.c with exported functions foo() and
bar(), and I compiled it and linked it with junk.o and garbage.o to make
a static library, then if I wrote a main.c that referenced bar() and
linked against the static library, my linker output would essentially
contain main.o and foobar.o.
If, instead of making a static library, you just make a single object
file from foobar.o, junk.o, and garbage.o, then link that big object
file with main.o, your linker output contains main.o, foobar.o, junk.o,
and garbage.o.
Question number 1: Is this true as far as you know?
Question number 2: If it is true, but you dead strip the linker result
in both cases, do you come out with the same result? (Which would be, if
I understand dead strip correctly, the contents of main.o plus whatever
portion of foobar.o is required to implement bar())
Regards,
Rush
_______________________________________________
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