Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
quick question...how about returning an array of longs? ..or in my case I have a pointer to an array of longs. Thanks Carsten Haese wrote: > On Tue, 2005-10-11 at 15:14, Java and Swing wrote: > > Anyhow, I need PyBuildValue to work. > > Try Py_BuildValue. > > HTH, > > Carsten Haese. -- htt

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
Carsten..thanks so much...that was it! DUH! Carsten Haese wrote: > On Tue, 2005-10-11 at 15:14, Java and Swing wrote: > > Anyhow, I need PyBuildValue to work. > > Try Py_BuildValue. > > HTH, > > Carsten Haese. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help creating extension for C function

2005-10-11 Thread Carsten Haese
On Tue, 2005-10-11 at 15:14, Java and Swing wrote: > Anyhow, I need PyBuildValue to work. Try Py_BuildValue. HTH, Carsten Haese. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
..ok I modified wrap_doStuff, so it just returns 0 instead of return PyBuildValuethis fixed the problems I had with compiling. however, when I try using it in Python..I get a SystemError: error return without exception set. Anyhow, I need PyBuildValue to work. One other note, the VC++ 6 comp

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
Fredrik, I now have this. myapp.c #include #include #include "Python.h" int doStuff(const char *input, const char *d) { ... } static PyObject *wrap_doStuff(PyObject *self, PyObject *args) { // get the arguments from Python int result; char *input = 0;

Re: Help creating extension for C function

2005-10-11 Thread Fredrik Lundh
Java and Swing wrote: > So is "module.c" a new C file or do I add it to my existing, myapp.c? it's a complete module. if you want it to do something other than printing the arguments, replace the "do stuff" section with your own code. if you want to call it something else, rename it. if you wa

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
also, I noticed you did python build-ext does that mean for any computer I want to run myapp on, I need to build the extension on it as well? Or can I build it once and just copy the files to another computer that has python already installed? If I just copy files, which files and where would

Re: Help creating extension for C function

2005-10-11 Thread Java and Swing
So is "module.c" a new C file or do I add it to my existing, myapp.c? Fredrik Lundh wrote: > >seq = PySequence_Fast(data, "expected a sequence"); > >if (!seq) > >return NULL; > > here's some more information on the PySequence_Fast API: > > http://www.effbot.org/zone/python-ca

Re: Help creating extension for C function

2005-10-08 Thread Fredrik Lundh
>seq = PySequence_Fast(data, "expected a sequence"); >if (!seq) >return NULL; here's some more information on the PySequence_Fast API: http://www.effbot.org/zone/python-capi-sequences.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: Help creating extension for C function

2005-10-08 Thread Fredrik Lundh
"Java and Swing" wrote: >I need to write an extension for a C function so that I can call it > from python. > > C code (myapp.c) > == > typedef unsigned long MY_LONG; > > char *DoStuff(char *input, MY_LONG *x) { ... } > > so you pass in a string and an array of MY_LONGS...such as > > MY_LONGS

Help creating extension for C function

2005-10-07 Thread Java and Swing
I need to write an extension for a C function so that I can call it from python. C code (myapp.c) == typedef unsigned long MY_LONG; char *DoStuff(char *input, MY_LONG *x) { ... } so you pass in a string and an array of MY_LONGS...such as MY_LONGS vals[10] = {}; char *input = "this is my