Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


question about linking


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 fir   Members   -  Reputation: -460

Like
0Likes
Like

Posted 23 June 2014 - 03:17 PM

I always do not know this - If i link many object  modules (or library) and thay contain the functions that are not called from my code will they be linked to or stripped out form final exe? Thare maybe may be some differences in behavoiur of modules and libraries but im not sure..

 

?

 

 



Sponsor:

#2 MJP   Moderators   -  Reputation: 11569

Like
2Likes
Like

Posted 23 June 2014 - 03:44 PM

If you're talking about static libs, then the behavior depends on the compiler toolchain you're using as well as the settings provided for the linker. In Visual C++ for instance, dead-code stripping is controlled by the /OPT:REF command-line option.



#3 fir   Members   -  Reputation: -460

Like
0Likes
Like

Posted 23 June 2014 - 03:49 PM

c standard is not saying something? or some common rule - that it is linked in or not?



#4 Bregma   Crossbones+   -  Reputation: 5242

Like
4Likes
Like

Posted 23 June 2014 - 06:02 PM

c standard is not saying something? or some common rule - that it is linked in or not?

"Linking" is not a concept addressed by the language standard, no.  There is no requirement in the language standard that a system offer separate compilation of modules, and indeed there are embedded systems that do not.

 

Practically, though, most modern (post-1960s at least) linkers will normally only satisfy undefined symbols from a static archive (library).  Dynamic shared objects (DLLs, .so files, .dylibs and so on) are loaded by the dynamic link-loader in their entirety, just as an executable is, but their symbol relocation tables may not be resolve until required (so-called "lazy" loading).  Command-line options can be used to vary that behaviour (eg. --Wl,-whole-archive passed to GCC).

 

Symbols from object modules may also have unreferenced symbols stripped.  That's going to depend on your linker and likely on the options passed o the linker.


Stephen M. Webb
Professional Free Software Developer




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS