title: C Python Module -- ImportError: Symbol not found: _Py_InitModule4_64
body: <p>I am beginning the process of writing Python 3 module in C.  The C I have written already compiles fine (code I compiled at bottom of post).  I compile with:</p>
  
  <pre><code>python3 setup.py build_ext --inplace
  </code></pre>
  
  <p>The built .so file is placed in the current directory.  After launching python3, when I import my module I get this error (tripple dot used to truncate paths):</p>
  
  <pre><code>&gt;&gt;&gt; import helloWorld
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  ImportError: dlopen(..., 2): Symbol not found: _Py_InitModule4_64
    Referenced from: .../helloWorld.cpython-36m-darwin.so
    Expected in: flat namespace
   in .../helloWorld.cpython-36m-darwin.so
  </code></pre>
  
  <p>How do I got about getting symbol <strong>_Py_InitModule4_64</strong> implemented?</p>
  
  <p>I am running macOS High Sierra if that means anything</p>
  
  <hr>
  
  <p>Running <em>nm</em> for <em>helloWorld.cpython-36m-darwin.so</em> shows _Py_InitModule4_64 is undefined, so does that prove there is an issue in the compilation process?</p>
  
  <pre><code>nm helloWorld.cpython-36m-darwin.so 
                   U _Py_BuildValue
                   U _Py_InitModule4_64
  0000000000000eb0 t _helloWorld
  0000000000001060 d _helloWorld_docs
  0000000000001020 d _helloworld_funcs
  0000000000000e80 T _inithelloWorld
                   U dyld_stub_binder
  </code></pre>
  
  <h2>Code</h2>
  
  <p>test.c:</p>
  
  <pre><code>#include &lt;Python/Python.h&gt;
  
  static PyObject* helloWorld(PyObject* self) {
     return Py_BuildValue("s", "Hello, Python extensions!!");
  }
  
  static char helloWorld_docs[] =
     "helloWorld( ): Any message you want to put here!!\n";
  
  static PyMethodDef helloworld_funcs[] = {
     {"helloWorld", (PyCFunction)helloWorld,
     METH_NOARGS, helloWorld_docs},
     {NULL}
  };
  
  void inithelloWorld(void) {
     Py_InitModule3("helloworld", helloworld_funcs, "Extension module example!");
  }
  </code></pre>
  
  <p>setup.py:</p>
  
  <pre><code>from distutils.core import setup, Extension
  
  setup(name = 'helloWorld', version = '1.0', \
      ext_modules = [Extension('helloWorld', ['test.c'])])
  </code></pre>