title: How to use the cl command?
body: <p>All, I found a piece of information on how to call c files in python, in these examples: there is a c file, which includes many other header files, the very beginning of this c files is <code>#include Python.h</code>, then I found that  <code>#include Python.h</code> actually involves many many other header files, such as  <code>pystate.h</code>,  <code>object.h</code>, etc, so I include all the required header files. In an cpp IDE environment, it did not show errors. <b>What I am trying to do is call this c code in python</b>, so  <code>from ctypes import *</code>, then it seems that a <code>dll</code> should be generated by code such as: <code>cl -LD test.c -test.dll</code>, but how to use the <code>cl</code> in this case? I used the cygwin: <code>gcc</code>, it worked fine. Could anyone help me with this <b>i.e.: Call the C in python</b>? Do I make myself clear? Thank you in advance!!</p>
  
  <p>Well, Now I feel it important to tell me what I did:
  The ultimate goal I wanna achieve is:
  I am lazy, I do not want to re-write those c codes in python, (which is very complicated for me in some cases), so I just want to generate <code>dll</code>
  files that python could call. I followed an example given by googleing "python call c", there are two versions in this examples: linux and windows:
  The example <code>test.c</code>:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  BOOL APIENTRY  
  DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)  {  
      return TRUE;  
  }  
  __declspec(dllexport) int 
  multiply(int num1, int num2)  {  
      return num1 * num2;  
  }
  </code></pre>
  
  <p>Two versions:
  1, Complie under linux</p>
  
  <pre><code>gcc -c -fPIC test.c  
  gcc -shared test.o -o test.so 
  </code></pre>
  
  <p>I did this in cygwin on my vista system, it works fine; :)</p>
  
  <p>2, Compile under windows:</p>
  
  <pre><code>cl -LD test.c -test.dll
  </code></pre>
  
  <p>I used the cl in windows command line prompt, it won't work!</p>
  
  <p>These are the python codes:</p>
  
  <pre><code>from ctypes import *   
  import os  
  libtest = cdll.LoadLibrary(os.getcwd() + '/test.so')  
  print test.multiply(2, 2)  
  </code></pre>
  
  <p>Could anyone try this and tell me what you get? thank you!</p>