By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,869 Members | 1,756 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,869 IT Pros & Developers. It's quick & easy.

Prevent linker from unnecessary symbol resolution

P: n/a
Hi all,
Suppose I have a C file fun1.c containing two functions:

__________
void func1() {
printf("\nIn function func1()\n");
}
void func2() {
func3();
}
___________

and another called hello.c containing:

___________
void main() {
func1();
}
___________

Is it possible to create a staticly linked binary using just these two
source files? Or do I have to provide a function definition for
func3(), even though it is not called by main (directly or
indirectly)?

Cheers,
Srikanth Madani
Nov 14 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 10 May 2004 05:36:33 -0700, in comp.lang.c , ka*********@yahoo.com
(Srikanth Madani) wrote:
Is it possible to create a staticly linked binary using just these two
source files? Or do I have to provide a function definition for
func3(), even though it is not called by main (directly or
indirectly)?


AFAIK thats completely compiler/linker dependent. I can imagine a good
linker optimising out the unused func2, and a bad one leaving it in. You'd
have to experiment or ask in a group specialising in your compiler.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.