Linking un-referenced function

Jason Lam jlam555@yahoo.com
Mon May 22 23:31:00 GMT 2006


Hi,

I looked through the documents and couldn't find an
option to not link an un-referenced function into the
final image.  Does GCC support it?  Could someone
please help?

For example, I have two functions in a file.  

example.c

void dummy_1 (void)
{
    printf("dummy 1\n");
}

void dummy_2 (void)
{
    printf("dummy 2\n");
}

dummy_1() is referenced by others in a different file
but not dummy_2().  However, dummy_2 is also got
linked to the final image.  It looks like the compiler
links functions by the entire object file but not by
each function.  Is there a way to exclude linking
dummy_2() to the final image?

Thank you very much for your help.

Regards,

Jason

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Gcc-help mailing list