title: Symbol not found, Expected in: flat namespace
body: <p>I have a huge <code>gl.pxd</code> file with all the definitions of <code>gl.h</code>, <code>glu.h</code> and <code>glut.h</code>. For example it has these lines:</p>
  
  <pre><code>cdef extern from '&lt;OpenGL/gl.h&gt;':
      ctypedef unsigned int GLenum
      cdef void glBegin( GLenum mode )
  </code></pre>
  
  <p>I have a <code>window.pyx</code> file, which looks like this:</p>
  
  <pre><code># Import OpenGL definitions
  # headers of gl, glu and glut
  from gl cimport *
  
  cdef int argcp
  cdef char **argv
  
  cdef void render_scene():
  
      glClear( GL_COLOR_BUFFER_BIT )
  
      glBegin( GL_TRIANGLES )
      glVertex2f( -.5, -.5)
      glVertex2f( .5, 0 )
      glVertex2f( 0, -5. )
      glEnd()
  
      glutSwapBuffers()
  
  cpdef main():
      # Initialize GLUT and create Window
      glutInit( &amp;argcp, argv )
      glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE )
      glutInitWindowPosition( 100, 100 )
      glutInitWindowSize( 1280, 720 )
      glutCreateWindow( 'My Shiny New Window' )
  
      # Register callbacks
      glutDisplayFunc( render_scene )
  
      # Enter GLUT event processing cycle
      glutMainLoop()
  </code></pre>
  
  <p>I also have a <code>setup.py</code> which looks like this:</p>
  
  <pre><code>from distutils.core import setup
  from distutils.extension import Extension
  from Cython.Distutils import build_ext
  
  setup(
      cmdclass = {'build_ext': build_ext},
      ext_modules = [Extension('window', ['window.pyx'])]
  )
  </code></pre>
  
  <p>Which I call with <code>python3 setup.py build_ext --inplace</code> and it compiles, and the output is this:</p>
  
  <pre><code>running build_ext
  cythoning window.pyx to window.c
  building 'window' extension
  /usr/bin/clang -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -arch i386 -arch x86_64 -I/Library/Frameworks/Python.framework/Versions/3.3/include/python3.3m -c window.c -o build/temp.macosx-10.6-intel-3.3/window.o
  /usr/bin/clang -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 -g build/temp.macosx-10.6-intel-3.3/window.o -o /Users/petervaro/cygl/window.so
  </code></pre>
  
  <p>And I have a <code>window_test.py</code> which looks like this:</p>
  
  <pre><code>import window
  window.main()
  </code></pre>
  
  <p>But if I want to run this python snippet I got this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/petervaro/cygl/window_test.py", line 3, in &lt;module&gt;
      import window
  ImportError: dlopen(/Users/petervaro/cygl/window.so, 2): Symbol not found: _glBegin
    Referenced from: /Users/petervaro/cygl/window.so
    Expected in: flat namespace
   in /Users/petervaro/cygl/window.so
  </code></pre>
  
  <p>My problem is really similar to this one:
  <a href="https://stackoverflow.com/q/7068721/2188562">What is the meaning of this ImportError when importing a Cython generated .so file?</a> -- although afaik I don't have an external library, I want to use the <em>builtin</em> OpenGL lib...</p>
  
  <p>Oh, and I'm on Mac OS X 10.8.5, Cython 19.2 and Python 3.3.
  Any help will be appreciated!</p>
  
  <p>Thanks in advance!</p>