title: ctypes error AttributeError symbol not found, OS X 10.7.5
body: <p>I have a simple test function on C++:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;locale.h&gt;
  #include &lt;wchar.h&gt;
  
  char fun() {
      printf( "%i", 12 );
  
     return 'y';
  }
  </code></pre>
  
  <p>compiling:</p>
  
  <pre><code>gcc -o test.so -shared -fPIC test.cpp
  </code></pre>
  
  <p>and using it in python with ctypes:</p>
  
  <pre><code>from ctypes import cdll
  from ctypes import c_char_p
  
  lib = cdll.LoadLibrary('test.so')
  hello = lib.fun
  hello.restype = c_char_p
  
  print('res', hello())
  </code></pre>
  
  <p>but then I get an error:</p>
  
  <pre><code>Traceback (most recent call last):   File "./sort_c.py", line 10, in &lt;module&gt;
      hello = lib.fun   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 366, in __getattr__
      func = self.__getitem__(name)   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ctypes/__init__.py", line 371, in __getitem__
      func = self._FuncPtr((name_or_ordinal, self)) 
  AttributeError: dlsym(0x100979b40, fun): symbol not found
  </code></pre>
  
  <p>Where is a problem?</p>
  
  <p>using:</p>
  
  <blockquote>
    <p>Mac Os X 10.7.5 and Python 2.7</p>
  </blockquote>