PYREX
Darrell
dgallion1 at yahoo.com
Tue Jun 25 09:31:33 EDT 2002
I've spent very little time with it. Just made it work and that's why
I love it. I use MSC 6 and the following setup.py, which I got from
Alex M. at the activestate python cookbook.
from distutils.core import setup, Extension
setup (name = "",
version = "1.0",
maintainer = "",
maintainer_email = "",
description = "Sample Python module",
ext_modules = [Extension('tcb',sources=['tcb.c','tcbBase.c'])]
)
#=======================
tcbBase.c has the detailed 'c' code and tcb.pyx has the interface.
cdef extern int openTcbC(int readTimeOut)
cdef extern int writeTcbC(char *cmdData, unsigned int cmdLen)
cdef extern char *readTcbC(unsigned int *bytesRead)
cdef extern PyString_FromStringAndSize(char *v, int len)
cdef extern int closeTcb()
def open(int readTimeOut):
return openTcbC(readTimeOut)
def write(data):
return writeTcbC(data, len(data))
def read():
cdef unsigned int bytesRead
cdef char *s
s=readTcbC(&bytesRead)
p=PyString_FromStringAndSize(s, bytesRead)
return p
def close():
closeTcb()
#==============================
This batch builds it all
python \python22\pyrexc.py tcb.pyx
setup.py build
copy C:\Python22\Lib\site-packages\Pyrex\Demos\build\lib.win32-2.2\*.pyd
.
#Yes I built in the demo directory :(
--Darrell
edlsoft at mindspring.com (Burt Leavenworth) wrote in message news:<3d1749d3.19107439 at news1.news.adelphia.net>...
> Has anyone installed Pyrex on Windows? If so, can you share the
> details?
>
> Burt
More information about the Python-list
mailing list