title: ImportError: dynamic module does not define init function
body: <p>I am trying to reproduce the following tutorial <a href="https://csl.name/post/c-functions-python/">https://csl.name/post/c-functions-python/</a>.</p>
  
  <p>My Python extension in <strong>C++</strong> looks like:</p>
  
  <pre><code>#include &lt;Python.h&gt;
  
  static PyObject* py_myFunction(PyObject* self, PyObject* args)
  {
    char *s = "Hello from C!";
    return Py_BuildValue("s", s);
  }
  
  static PyObject* py_myOtherFunction(PyObject* self, PyObject* args)
  {
    double x, y;
    PyArg_ParseTuple(args, "dd", &amp;x, &amp;y);
    return Py_BuildValue("d", x*y);
  }
  
  static PyMethodDef extPy_methods[] = {
    {"myFunction", py_myFunction, METH_VARARGS},
    {"myOtherFunction", py_myOtherFunction, METH_VARARGS},
    {NULL, NULL}
  };
  
  void initextPy(void)
  {
    (void) Py_InitModule("extPy", extPy_methods);
  }
  </code></pre>
  
  <p>I am using the following <strong>setup.py</strong>:</p>
  
  <pre><code>from distutils.core import setup, Extension
  setup(name='extPy', version='1.0',  \
  ext_modules=[Extension('extPy', ['extPy.cpp'])])
  </code></pre>
  
  <p>After invoking it with <code>python setup.py install</code> the .so file seems to be in the right place.</p>
  
  <p>But when I try to use this extension with <code>import extPy</code> I get the Error:</p>
  
  <p><em>ImportError: dynamic module does not define init function</em></p>
  
  <p>What am I missing here? Thanks for Help.</p>