Pages: [1]   Go Down
Author Topic: Quick question on compilers  (Read 559 times)
0 Members and 1 Guest are viewing this topic.
Madison, WI
Offline Offline
Newbie
*
Karma: 0
Posts: 25
No loafing.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

When you compile a piece of code that has files included in it.  What parts get compiled?  For instance, if I've created a library to take advantage of the full function of my MCP23017 I/O expander but I never call a specific function that I've coded in the header file, does that get compiled with everything and thus added onto the chip taking up some of the valuable programming space?  I'm familiar with asm and such, but compilers are a little out of my league.  Any thoughts?  If this has been asked before, any links?

Thanks for your time smiley

-Tweed
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
When you compile a piece of code that has files included in it.  What parts get compiled?

Everything fed to the compiler gets compiled into an "object file" (dot-obj file).

Quote
For instance, if I've created a library to take advantage of the full function of my MCP23017 I/O expander but I never call a specific function that I've coded in the header file, does that get compiled with everything


Yes.  However, the linker removes most "dead code".  From what you've described it is very likely that the unreferenced function will be removed by the linker.
Logged

Pages: [1]   Go Up
Jump to: