[Tutor] Making python extension in Windows

Mico Siahaan mico@intermatik.co.id
Mon May 26 01:04:02 2003


  Dear All, =0D
=0D
can anybody give me a hint aor HOWTO to make python extension in Windows?=
 I=0D
know there is a chapter about it in Python Programming on Win 32, but I d=
on=0D
t have Visual C++. The only C++ compiler I have is Dev C++. I did this: =0D
1. Add C:\Python21\include in Compiler Options/C Include Files =0D
2. Add C:\Python21\libs in Compiler Options/Libraries directory =0D
3. Open a new empty project =0D
4. Add spammodule.c (the example in Python Programming) into project =0D
5. In project options I checked 'Create a DLL' in project options =0D
6. Compile the project =0D
=0D
I got this warning from linker: =0D
c:\documents and settings\mico\my documents\spammodule.o(=0D
text+0x1d):spammodule.c: undefined reference to `_imp__PyArg_ParseTuple' =
=0D
c:\documents and settings\mico\my documents\spammodule.o(=0D
text+0x52):spammodule.c: undefined reference to `_imp__Py_BuildValue' =0D
c:\documents and settings\mico\my documents\spammodule.o(=0D
text+0xa3):spammodule.c: undefined reference to `_imp__Py_InitModule4' =0D
c:\documents and settings\mico\my documents\spammodule.o(=0D
text+0xba):spammodule.c: undefined reference to `_imp__PyModule_GetDict' =
=0D
c:\documents and settings\mico\my documents\spammodule.o(=0D
text+0xd6):spammodule.c: undefined reference to `_imp__PyErr_NewException=
' =0D
c:\documents and settings\mico\my documents\spammodule.o(=0D
text+0xfa):spammodule.c: undefined reference to `_imp__PyDict_SetItemStri=
ng'
=0D
Warning: no export definition file provided =0D
dllwrap will create one, but may not be what you want =0D
C:\PROGRA~1\DEVC__~1\Bin\dllwrap: gcc exited with status 1 =0D
=0D
Then there is spammodule.o in my directory. I copied it to python lib=0D
directory, renamed it to spam.pyd, then tried to import in, but I failed.=
 =0D
=0D
Can anybody tell me how to make python extension in WIndows using Dev C++=
? =0D
=0D
Thanks. And sorry for this long email. :) =0D
=0D
-mico-=20