title: Undefined symbol when importing a cython module making use of another cython module
body: <p>I'm working on wrapping a set of C functions using Cython into a module. I would like to be able to cimport this first module into subsequent Cython-based projects, but I am running into an 'undefined symbol' issue when importing the derivative modules in a python script.</p>
  
  <p>Consider the following minimal working example of two modules developed in separate directories:</p>
  
  <pre><code># exModA wraps the functions provided in exModAFxn.c
  exModA/
      __init__.pxd
      __init__.py
      exModAFxn.c
      exModA.pyx
      setup.py
  # exModB attempts to use the cdef functions from exModA
  exModB/
     __init__.py
     exModB.pyx
     setup.py
  # The test script attempts to make use of exModB
  test.py
  </code></pre>
  
  <p>exModA/__init__.pxd:</p>
  
  <pre><code>cdef extern void myCMessage()
  </code></pre>
  
  <p>exModA/__init__.py:</p>
  
  <pre><code>from exModA import *
  </code></pre>
  
  <p>exModA/exModAFxn.c:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  void myCMessage() { printf( "This is a test!\n" ); }
  </code></pre>
  
  <p>exModA/exModA.pyx:</p>
  
  <pre><code>cdef extern from "exModAFxn.c" :
      void myCMessage()
  # Use myCMessage in a python function
  def foo() :
      myCMessage()
  </code></pre>
  
  <p>exModA/setup.py:</p>
  
  <pre><code>from distutils.core import setup, Extension
  from Cython.Build import cythonize
  setup( 
      name = 'exModA',
      ext_modules = cythonize( ['exModA/exModA.pyx'] ),
  )
  </code></pre>
  
  <p>exModB/__init__.py:</p>
  
  <pre><code>from exModB import *
  </code></pre>
  
  <p>exModB/exModB.pyx:</p>
  
  <pre><code>cimport exModA
  # Use a cdef function from exModA in a python function
  def bar() :
      exModA.myCMessage()
  </code></pre>
  
  <p>exModB/setup.py:</p>
  
  <pre><code>from distutils.core import setup, Extension
  from Cython.Build import cythonize
  setup( 
      name = 'exModB',
      ext_modules = cythonize( ['exModB/exModB.pyx'] ),
  )
  </code></pre>
  
  <p>The test.py script is called after compiling the two cython modules.</p>
  
  <pre><code>python extModA/setup.py build_ext --inplace
  python extModB/setup.py build_ext --inplace
  </code></pre>
  
  <p>test.py:</p>
  
  <pre><code>import exModA
  exModA.foo()    # successfully prints message
  import exModB   # raises ImportError: undefined symbol: myCMessage
  exModB.bar()    # we never get to this line :(
  </code></pre>
  
  <p>The successful printing of the message from the exModA.foo function suggests to me that myCMessage is in fact available, but it isn't found when exModB is imported. I know this problem goes away if I merged exModA and exModB into a single project, but I'd like to avoid that approach if possible -- I'm trying to expose a common set of wrappers for a C library for use in several different applications.</p>