Suicide by C++ And How to Avoid It

photo courtesy of To Be A Pilgrim blog.

You may have seen The Onion's story about some recent ground-breaking research ...

New Study Shows People With Panic Disorders Respond Poorly To Being Locked In Underwater Elevators

If you get the same reaction every time you realize your C++ code is hopelessly tangled up with your C++ libraries, you may find some relief in this series by Darryl Gove and Stephen Clamage.

  • Introduction to Libraries and Linking - How to make sure that your Oracle Solaris application links to the libraries it needs correctly and in the right order.
  • Part II - Resolving Symbols in Libraries - How to use the -z defs flag in your code to make sure the runtime linker links your application to the correct C++ libraries.
  • Part III - What Happens When An Application Starts - How investigate run-time application linking problems by using the LD_DEBUG environment variable.
  • Part IV - Avoiding Linking Problems - How to identify duplicate symbols and circular dependencies in your C++ code that would lead to linking problems between your application and its libraries.
  • Part V - Libraries in C++ - A detailed demonstration of how your C++ compiler can bind to a symbol from the incorrect library at compile time, and how to use the -g compiler flag to detect it.
  • Part VI - Resolving the Initialization Order Problem - Using link *order* to resolve C/C++ library dependencies is quick, but not optimal. Better to use either -instlib to keep the compiler from generating multiple templates, or use the -Bdirect linker flag to record dependencies at run time. This article explains how.
  • Part VII - Using Symbol Scoping to Avoid Linking Issues - By default, a symbol defined in a library is visible to other libraries and executables. You can limit a symbol's scope in a number of ways, including symbolic binding, hidden scope, and interposing. How to and examples described here.
  • Part VIII - Concluding Remarks and Summary of Best Practices - Building an application as a combination of executables and library calls has many advantages but potential problems with the links between the executable and its libraries. By using the techniques described in this series of articles, you can identify problems and make the risks manageable.

- Rick
System Admin and Developer Community of OTN
OTN Garage Blog
OTN Garage on Facebook
OTN Garage on Twitter

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Contributors:
Rick Ramsey
Kemer Thomson
and members of the OTN community

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Blogs We Like