calldll & PyArg_ParseTuple strings

Scott McClellan Scott.McClellan at p98.f112.n480.z2.fidonet.org
Sat Jul 3 16:12:29 EDT 1999


From: Scott McClellan <801d at my-deja.com>

Hello,

I'm attempting to use Sam Rushing's calldll module to call a C function
in a dll, with the following prototype:

long __declspec(dllexport)func(long *x, long *y, long *z)

I expect the function to give certain values back in x, y, and z, but so
far have been unable to make that happen. Let's say that I have three
long integers in Python that I initialize as follows:

x=y=z=0L

My question is, in the following call from Python,

call_foreign_function(pFunc, 'lll', 'l', (<?>,<?>,<?>))

what should the tuple (<?>,<?>,<?>) contain?  If I pass (x,y,z),
the Python interpreter (Idle in my case) crashes, and this is
understandable, since it results in the contents of x, y, and z being
used as addresses to write to.  I've tried (id(x),id(y),id(z)), since
id() is supposed to return the address of a Python object - Python
didn't crash as before, but nothing was copied into x, y, and z, either.

Can anyone point me in the right direction?

Thanks,
Scott McClellan


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.




More information about the Python-list mailing list