title: Use Cython to link python to a shared library in Mac OS
body: <p>I'm try to integrate with others who give to me a shared library just only <code>.so</code> files and the <code>.h</code> files.<br>
  In mac os, the shared library should be <code>.dylib</code>, But I don't how to set the environment or other way to solve the problems When I want to try to link with the shared library  <code>.so</code> files in mac.</p>
  
  <p>I have a <code>pyd/pyx</code> file I created manually.
  for example, just I have a named <code>hellopy.so</code> shared library.
  the Distutils setup.py files:</p>
  
  <pre><code>from setuptools import setup, find_packages
  from Cython.Build import cythonize
  from Cython.Distutils import build_ext, Extension
  
  other_dir=''
  cython_header_dir =''
  common_args = {
  "include_dirs": [other_dir],
  "library_dirs": [other_dir],
  "language": "c++",
  "cython_include_dirs": [cython_header_dir],
  }
  
  extensions = [
  Extension(name="api.api",
            sources=["api/api.pyx"],
  
            extra_compile_args=[],
            extra_link_args=[],
            # todo fix libraries problems
            libraries=["hellopy"],
            **common_args),
  
  setup(
  
      include_package_data=True,
      install_requires=["Cython&gt;=0.22"],
      setup_requires=["Cython&gt;=0.22"],
      packages=find_packages(),
      cmdclass={"build_ext": build_ext},
      ext_modules=cythonize(extensions),
      exclude_package_data={"": ["*.cpp"]}
  )
  </code></pre>
  
  <p>then try to compile the package.  </p>
  
  <pre><code>python setup.py build_ext --inplace
  ld: library not found for -lhellopy
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>