<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1226" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; I have a possibly stupid 
question -- my apologies. I am trying to build some modules written on a Linux 
platform in Windows (Windows 2000) using mingw32.&nbsp; I have tried building 
the following REALLY basic module and am getting some strange errors (it works 
fine with VC++ 6.0). My command line is</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>python setup.py build -c mingw32</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Module:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>#include &lt;Python.h&gt;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>static PyObject *myfoo(PyObject *self, PyObject 
*args, PyObject *keywords);</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>/* Module methods */</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>static PyMethodDef FooMethods[] = {<BR>&nbsp; 
{"_myfoo",&nbsp; (PyCFunction) myfoo, METH_VARARGS|METH_KEYWORDS, 
"FOO!"},<BR>&nbsp; {NULL, NULL, 0, 
NULL}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Sentinel 
*/<BR>};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>/* Initialize the module foo */</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>void initfoo(void)<BR>{<BR>&nbsp; PyObject 
*module;<BR>&nbsp; module = Py_InitModule("foo", FooMethods);<BR>}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>static PyObject *myfoo(PyObject *self, PyObject 
*args, PyObject *keywords)<BR>{<BR>&nbsp; int output_int;</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp; char *keyword_list[] = {"output_int", 
NULL};</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp; if (! PyArg_ParseTupleAndKeywords(args, 
keywords, "i", keyword_list, &amp;output_int)) {<BR>&nbsp;&nbsp;&nbsp; 
PyErr_SetObject(PyExc_TypeError, Py_BuildValue("OO", args, keywords)); 
<BR>&nbsp;&nbsp;&nbsp; return NULL;<BR>&nbsp; } </FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp; fprintf(stderr,"%d\n", 
output_int);<BR>&nbsp; return(Py_None); <BR>}<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Here is my setup.py file</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>from distutils.core import setup, 
Extension<BR>import os</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>libraries=[]<BR>library_dirs=[]<BR>include_dirs=[]</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>mincutils_mod = 
[]<BR>mincutils_mod.append(Extension('foo', sources = 
['foo.c'],<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
include_dirs=include_dirs,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
library_dirs=library_dirs,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
libraries=libraries))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
<BR>setup (name = 'foo',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; version = 
'0.4',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; description = 'This is a package 
to foo.',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; author = 'Jonathan E. 
Taylor',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; author_email = <A 
href="mailto:'jonathan.taylor@stanford.edu'">'jonathan.taylor@stanford.edu'</A>,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
url = '',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long_description = 
'''<BR>''',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ext_modules = 
mincutils_mod)</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>and the error messages:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>F:\Python Example&gt;python setup.py build -c 
mingw32<BR>running build<BR>running build_ext<BR>building 'foo' 
extension<BR>writing 
build\temp.win32-2.3\Release\foo.def<BR>F:\MinGW\bin\gcc.exe -mno-cygwin -shared 
-s build\temp.win32-2.3\Release\foo.o b<BR>uild\temp.win32-2.3\Release\foo.def 
-LF:\Python23\libs -LF:\Python23\PCBuild -lp<BR>ython23 -o 
build\lib.win32-2.3\foo.pyd<BR>build\temp.win32-2.3\Release\foo.o(.text+0x94):foo.c: 
undefined reference to 
`_i<BR>mp__PyExc_TypeError'<BR>build\temp.win32-2.3\Release\foo.o(.text+0xc1):foo.c: 
undefined reference to `_i<BR>mp___Py_NoneStruct'<BR>error: command 'gcc' failed 
with exit status 1<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Any help would be greatly appreciated.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jonathan Taylor</DIV>
<DIV><BR></DIV></FONT></BODY></HTML>