title: strange crash on osx lion possibly due to bad symbol lookup
body: <p>I have a c++ app running on OS/X Lion which crashes in a call to glIsBuffer(0). The XCode 4.5 stack trace states:</p>
  
  <p>error: address doesn't contain a section that points to a section in a object file</p>
  
  <p>and DYLD_PRINT_APIS shows:</p>
  
  <pre><code>dlopen(/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/CoreGraphics, 0x00000009)
  ...
  dlsym(0x7f9288d00cd0, gliCopyAttributes)
  dlsym(0x7f9288d00cd0, gliGetVersion)
  dlsym(0x7f9298d70620, __CGBitmapContextDelegateCreate)
  dlsym(0xffffffffffffffff, CGSCopyCoreGraphicsCapabilities)
  Segmentation fault: 11
  </code></pre>
  
  <p>The last call to dlsym() appears to have been passed a rather strange library handle. I looked at the return values for dlopen, but it should be returning NULL on error. There are no errors reported for the dlopen calls in the log.</p>
  
  <p>CGSCopyCoreGraphicsCapabilities is a Core Graphics call, though Google doesn't turn up any docs on it. My current hypothesis is that dlsym is using an invalid library handle. Perhaps the proper Core Graphics library is not loaded or has been unloaded.</p>
  
  <p>Running otool shows a few version mismatches:</p>
  
  <pre><code>/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
  /usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
  </code></pre>
  
  <p>but I don't know enough to say whether they are relevant.</p>
  
  <p>Can anyone help to decipher what might be the problem?</p>
  
  <p>thanks!</p>