Re: Call C functions from Python

2005-10-05 Thread Fredrik Lundh
"Java and Swing" wrote: >i dont have a myapp.pyd ...i have myapp.c, or are u suggesting I dump > the dll? if that's what you're trying to import, yes. > or the swig generated python file? > the swig generated python file only has .py and .pyc. huh? if you have a swig-generated python file, why

Re: Call C functions from Python

2005-10-05 Thread Java and Swing
i dont have a myapp.pyd ...i have myapp.c, or are u suggesting I dump the dll? or the swig generated python file? the swig generated python file only has .py and .pyc. -- http://mail.python.org/mailman/listinfo/python-list

Re: Call C functions from Python

2005-10-05 Thread Fredrik Lundh
"Java and Swing" wrote: >>> from ctypes import * >>> myapp = cdll.LoadLibrary("c:\\myapp.dll") >>> dumpbin /exports myapp.pyd > > i get, SyntaxError: invalid syntax with it pointing at the first "p" in > myapp.pyd. dumpbin is a command-line utillity, usually included in the compiler toolsuite...

Re: Call C functions from Python

2005-10-05 Thread Grant Edwards
On 2005-10-05, Java and Swing <[EMAIL PROTECTED]> wrote: > i tried... > >>> from ctypes import * >>> myapp = cdll.LoadLibrary("c:\\myapp.dll") >>> dumpbin /exports myapp.pyd > > i get, SyntaxError: invalid syntax with it pointing at the first "p" in > myapp.pyd. Um, just a guess, but I don't think

Re: Call C functions from Python

2005-10-05 Thread Java and Swing
i tried... >> from ctypes import * >> myapp = cdll.LoadLibrary("c:\\myapp.dll") >> dumpbin /exports myapp.pyd i get, SyntaxError: invalid syntax with it pointing at the first "p" in myapp.pyd. -- http://mail.python.org/mailman/listinfo/python-list

Re: Call C functions from Python

2005-10-05 Thread Fredrik Lundh
Java and Swing wrote: >I used, myApp = CDLL("C:...") ...as I saw it in one of the ctypes > samples. > > Anyhow, I tried... > > myApp = cdll.LoadLibrary("C:\\myapp.dll") > myApp.AddNumbers(1, 4) > > ..I get an error... > > AttributeError: function 'AddNumbers' not found > > ...myapp certainly has A

Re: Call C functions from Python

2005-10-05 Thread Java and Swing
I used, myApp = CDLL("C:...") ...as I saw it in one of the ctypes samples. Anyhow, I tried... myApp = cdll.LoadLibrary("C:\\myapp.dll") myApp.AddNumbers(1, 4) ..I get an error... AttributeError: function 'AddNumbers' not found ...myapp certainly has AddNumbers. Grant Edwards wrote: > On 2005-

Re: Call C functions from Python

2005-10-04 Thread Martin v. Löwis
Java and Swing wrote: > Is there some other way, besides SWIG, which will allow me to call > functions inside an Ansi C DLL? You could write an extension module. See Modules/xxmodule.c in the Python source tree, as well as http://docs.python.org/ext/ext.html In the specific case, if it weren't f

Re: Call C functions from Python

2005-10-04 Thread Grant Edwards
On 2005-10-04, Java and Swing <[EMAIL PROTECTED]> wrote: > ok i got ctypes...now i try > >>> from ctypes import * >>> myApp = CDLL("C:\\myapp.dll") I've never seen that sort of usage before. I don't know what CDLL does, and I can't find it in the docs anywhere. Based on my reading of the tutoria

Re: Call C functions from Python

2005-10-04 Thread Java and Swing
ok i got ctypes...now i try >> from ctypes import * >> myApp = CDLL("C:\\myapp.dll") ..now how can I call functions on in myapp.dll? From the tutorial I am not sure..i try, dir(cdll.myApp) and dir(myApp)..but don't see my functions listed. thanks Grant Edwards wrote: > On 2005-10-04, Java and

Re: Call C functions from Python

2005-10-04 Thread Grant Edwards
On 2005-10-04, Java and Swing <[EMAIL PROTECTED]> wrote: > Is there some other way, besides SWIG, which will allow me to call > functions inside an Ansi C DLL? ctypes -- Grant Edwards grante Yow! Now KEN and BARBIE at

Call C functions from Python

2005-10-04 Thread Java and Swing
Is there some other way, besides SWIG, which will allow me to call functions inside an Ansi C DLL? Example (C): defs.h --- typedef unsigned long MY_DIGIT; myapp.c - #include "defs.h" char *DoSomeStuff(char *input, MY_DIGIT *digits) { ... } ..thats an example of somethi