<DIV>Thanks, Chris</DIV>  <DIV>&nbsp;</DIV>  <DIV>I will send my simple example to you later on </DIV>  <DIV>&nbsp;</DIV>  <DIV>&nbsp;</DIV>  <DIV>Zhi <BR><BR><B><I>Christopher Barker &lt;Chris.Barker@noaa.gov&gt;</I></B> wrote:</DIV>  <BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid">On Tuesday 13 December 2005 7:24 pm, Zhi Peng wrote:<BR>&gt; I would like<BR>&gt; to have a small C code and then compile and linked as dynamic library so<BR>&gt; that it can be imported by python code as we had in Linux platform.<BR><BR>Are you doing exactly the same thing on OS-X and Linux? Are you using <BR>distutils to compile your *.so? If so, it should work.<BR><BR>&gt; Mac terminal looks like unix/linux, but there are some difference, which<BR>&gt; I may not know enough.<BR><BR>The differences, as far as this is concerned, are:<BR><BR>* that OS-X requires different flags and what not for compiling and linking -- <BR>distutils should take care of
 that for you<BR><BR>* Any GUI program needs to be run from inside an application bundle. This is <BR>true for pure C / C++ programs as well. For Python, pythonw does that for <BR>you.<BR><BR>&gt; In C code, all argumnet, parameters have to be <BR>&gt; changed to in PyObject form, otherwise, python code may not be able to call<BR>&gt; the function.<BR><BR>This makes it sound like you are doing more than trying to get an extension <BR>that works on Linux to work on the mac. Yes, extensions can only recieve and <BR>return PyObjects to/from Python code, but inside your extension you jsut <BR>write regular old C.<BR><BR>SWIG is one way to generate code that translates C types into PyObjects. You <BR>can also do it by hand (or use pyrex, Boost::python, SIP, etc.).<BR><BR>&gt; Not sure if anyone trys swig utility on other platform?<BR><BR>I've used it on Linux only, but it certainly works on OS-X. wxPython is built <BR>with it, for a large-scale example!<BR><BR>&gt; on <BR>&gt; swig home
 page, there is an example, it might work on linux/unix. But it<BR>&gt; does not work well on Mac as I tried it.<BR><BR>post that example, if we are to help you, that's exactly what we need, a <BR>simple example. And post exactly what you did to compile it!<BR><BR>-Chris<BR><BR><BR><BR>-- <BR>Christopher Barker, Ph.D.<BR>Oceanographer<BR><BR>NOAA/OR&amp;R/HAZMAT (206) 526-6959 voice<BR>7600 Sand Point Way NE (206) 526-6329 fax<BR>Seattle, WA 98115 (206) 526-6317 main reception<BR><BR>Chris.Barker@noaa.gov<BR>_______________________________________________<BR>Pythonmac-SIG maillist - Pythonmac-SIG@python.org<BR>http://mail.python.org/mailman/listinfo/pythonmac-sig<BR></BLOCKQUOTE>  <DIV><BR></DIV><p>
        
                <hr size=1>Yahoo! Shopping<br> 
Find Great Deals on Holiday Gifts at <a href="http://us.rd.yahoo.com/mail_us/footer/shopping/*http://shopping.yahoo.com/;_ylc=X3oDMTE2bzVzaHJtBF9TAzk1OTQ5NjM2BHNlYwNtYWlsdGFnBHNsawNob2xpZGF5LTA1 
">Yahoo! Shopping</a>