You are not logged in.

#1 2005-04-08 18:11:46

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

wow, python ctypes

http://starship.python.net/crew/theller/ctypes/

This is the greatest thing I've ever seen - look through the tutorial

Offline

#2 2005-04-08 23:54:47

xerxes2
Member
From: Malmoe, Sweden
Registered: 2004-04-23
Posts: 1,249
Website

Re: wow, python ctypes

is it like pyrex?


arch + gentoo + initng + python = enlisy

Offline

#3 2005-04-09 17:44:41

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: wow, python ctypes

no.. it's a direct interface to C

libm = cdll("libm.so")
b = cdouble(20)
result = libm.cos(b)

that, while probably not right, will load libm.so and call cos from that lib... yeah that's not the greatest example in the world... but think of what you can do....

I may be wrong, but pyrex is more of a python extension.... whereas ctypes is actually written in python

Offline

#4 2005-04-09 22:30:51

neri
Forum Fellow
From: Victoria, Canada
Registered: 2003-05-04
Posts: 552

Re: wow, python ctypes

phrakture wrote:

no.. it's a direct interface to C

libm = cdll("libm.so")
b = cdouble(20)
result = libm.cos(b)

that, while probably not right, will load libm.so and call cos from that lib... yeah that's not the greatest example in the world... but think of what you can do....

I may be wrong, but pyrex is more of a python extension.... whereas ctypes is actually written in python

*cough* , I have an PKGBUILD for it for a long time, since I hoped to get
rox-system working this way, but it failed. Anyway, here is the updated
PKGBUILD

# $Id$
# Contributor: Tobias Kieslich <tobias@justdreams.de>

pkgname=python-ctypes
_srcname=ctypes
pkgver=0.9.6
pkgrel=1
pkgdesc="package to manipulat C data types. Allows wrapping C-libs in Python"
url="http://starship.python.net/crew/theller/ctypes/"
depends=('python>=2.4')
source=(http://belnet.dl.sourceforge.net/sourceforge/$_srcname/$_srcname-$pkgver.tar.gz)

build() {
  cd $startdir/src/$_srcname-$pkgver
  python setup.py build
  python setup.py install --root=$startdir/pkg
}
# vim: ft=sh ts=2

neri

Offline

Board footer

Powered by FluxBB