title: create dylib in mac import in python
body: <p>Hi i know how to make Library (dll) in windows with visual studio 2012 with c++
  and import in python with ctypes work great</p>
  
  <p>here small example</p>
  
  <p>lib.cpp</p>
  
  <pre><code>#define DLLEXPORT extern "C" __declspec(dllexport)
  DLLEXPORT int sum(int a,int b)
  {
  return (a+b);
  }
  </code></pre>
  
  <p>lib.h</p>
  
  <pre><code>int sum(int,int); 
  </code></pre>
  
  <p>test.py</p>
  
  <pre><code>from ctypes import *
  mydll=cdll.LoadLibrary('lib.dll')
  print mydll.sum(2,2)
  </code></pre>
  
  <p>i try run same code in mac with xcode 4.4 version
  when i buld in xcode i get warring message</p>
  
  <pre><code>__declspec attribute 'dllexport' is not supported
  </code></pre>
  
  <p>and when import lib.dylib in python i get error</p>
  
  <pre><code>AttributeError: dlsym(0x101afba30, sum): symbol not found
  </code></pre>
  
  <p>what i do wrong ?
  can some one write simple code how i can make a dylib in mac with xcode correct to import with Ctypes in python 2.6.4 </p>
  
  <p>OR</p>
  
  <p>the are is better way to import libaries in python in both system
  for mac and win ? </p>
  
  <p>basic i like to write code in windows with visual studio 2012 make dll i
  and then simple compiler in mac with xcode and import in python </p>