|
-
Jan 17th, 2004, 08:44 PM
#1
Thread Starter
Hyperactive Member
To link or not to link
I got question on linking particularly in msvc6.
Lets say I have the winmain in the main.cpp ->main.obj
I have a foo class=>foo.obj
and
foobar class->foobar.obj
In main i only have an instance of foo class.
Basically I want to compile both classes but only link foo.obj.
So is there a way to tell the linker "Hey if theres no instances of class foobar, dont link it in"??
Thanks
-
Jan 18th, 2004, 06:36 AM
#2
No, not automatically. Why do you want to compile foobar if there are no instances?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 18th, 2004, 06:57 AM
#3
Fanatic Member
I would have thought it'd be optimized out anyway if there's no instances.
-
Jan 18th, 2004, 10:27 AM
#4
Not necessarily. It depends on the linker and its settings. And some more stuff. In general, stuff from .libs gets included only when needed, stuff from .objs always.
Still, you could simply NOT compile the file...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 18th, 2004, 10:28 AM
#5
That sort of optimization can only be done by the linker. For example there could be a bar.obj that uses the foobar class, in which case it should not be discarded.
-
Jan 18th, 2004, 11:07 AM
#6
Thread Starter
Hyperactive Member
Thanks for answer.
CornedBee,
I was just exploring a GUI designer idea.
So ill go with libs.
Thanks
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
|