|
-
April 1st, 2012, 07:34 AM
#12
Re: libraries and linking
So, no comments, no questions? Seems I need to add some more to my last reply.
i) if I tell project A where B's library files are, it produces an A.lib file which is bigger
This means that librarian extracts all required objects from B and archives them to A.
ii) if I build app P against A, it will only do so successfully if project A knows about B's library files.
Of course it will. Remember, A depends on B, and when building P all the external dependencies, direct or indirect, need to be resolved.
There are two situations possible with P, A and B successful build:
Prerequisite: Library A functions require some functions from library B.
1. A is built extracting required functions from library B. Executable P depends only on functions from library A (as the one already includes all necessary functions from B). Once A is built this way, P never needs B to be included to the project. Please note, in this case A needs B to be included in A project.
2. Library A is build without including B in A project, so it contains references to B functions unresolved. In this case when linking P, functions from A still need the functions from B to be resolved, and this results in extra dependency on B for P. Please note, in this case P needs B to be included in P project.
In first case rebuilding A will need path to B to be known in A project. Rebuilding P will depend only on path to A.
In second case rebuilding P will need both A and B path to be known in P project.
In both cases some indirect or direct dependency on B exists. Just because A functions depend on B functions. The only way to eliminate dependency on B is moving B source code to A. This is what Paul already mentioned before.
These two points clearly demonstrate that project A is copying B's code and putting it into A.
Well, rephrasing you, object code from B appears archived to library A. Yes, that's right.
I want to arrange things so that P depends only on A, and P does not depend on B. How do I arrange this?
You already did. P depends only on A. If you never rebuild A, P is going to build with no problem ever.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|