From seth at tewebs.com Sun May 23 20:57:38 2010 From: seth at tewebs.com (Seth Burleigh) Date: Sun, 23 May 2010 15:57:38 -0500 Subject: [clpython-devel] c api? Message-ID: <1274648258.2501.0.camel@seth-laptop> I was wondering about the difficulties involved in adding the python c api, since it would be extremely useful. From metawilm at gmail.com Mon May 24 08:45:53 2010 From: metawilm at gmail.com (Willem Broekema) Date: Mon, 24 May 2010 10:45:53 +0200 Subject: [clpython-devel] c api? In-Reply-To: <1274648258.2501.0.camel@seth-laptop> References: <1274648258.2501.0.camel@seth-laptop> Message-ID: On Sun, May 23, 2010 at 10:57 PM, Seth Burleigh wrote: > I was wondering about the difficulties involved in adding the python c > api, since it would be extremely useful. Hey Seth, I used to be skeptical about supporting the C API in CLPython, but now IronPython (the .Net implementation) has started to support C extensions with a component called IronClad, with apparently most of NumPy already working: http://www.resolversystems.com/products/ironclad/ Interesting implementation details: http://ironclad.googlecode.com/svn-history/r108/trunk/doc/details.txt That they got it working is a nice surprise. But I don't know if their approach would work for CLPython... - Willem From seth at tewebs.com Mon May 24 14:41:29 2010 From: seth at tewebs.com (Seth Burleigh) Date: Mon, 24 May 2010 09:41:29 -0500 Subject: [clpython-devel] c api? In-Reply-To: References: <1274648258.2501.0.camel@seth-laptop> Message-ID: <1274712089.25442.24.camel@seth-laptop> On Mon, 2010-05-24 at 10:45 +0200, Willem Broekema wrote: > On Sun, May 23, 2010 at 10:57 PM, Seth Burleigh wrote: > > I was wondering about the difficulties involved in adding the python c > > api, since it would be extremely useful. > > Hey Seth, > > I used to be skeptical about supporting the C API in CLPython Hmm, i must be missing something obvious. Looking at http://docs.python.org/library/ctypes.html it seems that it would just be a matter of converting from the ctypes api to the cffi api. Though scanning it i don't see how some things could be done, like examining the stack for windows to see if you passed the wrong amount of arguments. Most othres, however, like endianess of structures, using custom datatypes, are all possible. From metawilm at gmail.com Mon May 24 15:30:58 2010 From: metawilm at gmail.com (Willem Broekema) Date: Mon, 24 May 2010 17:30:58 +0200 Subject: [clpython-devel] c api? In-Reply-To: <1274712089.25442.24.camel@seth-laptop> References: <1274648258.2501.0.camel@seth-laptop> <1274712089.25442.24.camel@seth-laptop> Message-ID: On Mon, May 24, 2010 at 4:41 PM, Seth Burleigh wrote: > it seems that it would just be a matter of converting from the ctypes > api to the cffi api. Though scanning it i don't see how some things > could be done, like examining the stack for windows to see if ?you > passed the wrong amount of arguments. Most othres, however, like > endianess of structures, using custom datatypes, are all possible. Yes, ctypes looks implementable with CFFI. If you give it a try, let me know how it goes :) There are many C extensions for Python that are using this API instead: http://docs.python.org/c-api/ -- and supporting all of that is a challenge. - Willem From seth at tewebs.com Mon May 24 16:25:09 2010 From: seth at tewebs.com (Seth Burleigh) Date: Mon, 24 May 2010 11:25:09 -0500 Subject: [clpython-devel] c api? In-Reply-To: References: <1274648258.2501.0.camel@seth-laptop> <1274712089.25442.24.camel@seth-laptop> Message-ID: <1274718309.26909.0.camel@seth-laptop> Is this a new release for python 2.6? Hmm... looks interesting.