• Advertisement
Sign in to follow this  

Static link vs. source

This topic is 4225 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just wondering what the general consensus on this subject; given the choice for an external library that you plan on using, would most people here prefer using a statically linked library or compile that libraries code into their app themselves. I prefer the former since a single lib is much easer to link to your code than a ton of additional files. On the other hand having the code available to debug in case (ehem, when) something goes wrong is nice. What's everybody elses take on this (what are other benefits otherwise)?

Share this post


Link to post
Share on other sites
Advertisement
I'm not quite sure what you mean. Are you talking about third party libraries?

If so, I guess you are asking whether it is preferrable to have the source code for a third party library available or not. Even if it was, it would be good practice to still compile this library seperately and link an object file to your application at the very least, which isn't really much different from linking to a static lib.

If I felt the need to modify the code of a third party library, I'd look for a better library first.

If you are talking about using your own external libraries, provided you have a good IDE, or are familiar with using MAKE, it shouldn't be much more complicated to compile all your various units seperately and link them together.

My opinion is that (with C++ at least) all the language features in the world will not help if you structure your program in such a way that the preprocessor turns it into one enormous source file and compiles it as one unit.

Sorry if I have missed the point of your question.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Dirge
I prefer the former since a single lib is much easer to link to your code than a ton of additional files. On the other hand having the code available to debug in case (ehem, when) something goes wrong is nice.


Linking a library doesn't hinder your ability to debug, as long as you have the sources to the library.

Share this post


Link to post
Share on other sites
I was referring to third party libraries and more along the lines of free/open source ones. I was aware that it's always preferrable to have the source and that debugging a lib is possible with the source present but I wanted to see if anyone could think of any situations where it's not preferable to use a lib (over just compiling in the source).

BTW I was thinking more in an MSDEV environment instead of unix using MAKE and such. I'm certainly not suggesting putting all the code into one big source file to generate an obj from (think .a archives instead).

I guess there's just no point otherwise in just not using the lib. Thanks for the input.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement