ctypes calling delphi dll
Brian Elmegaard
brian at rk-speed.rugby.dk
Wed Dec 18 04:40:14 EST 2002
Hi,
I just discovered the ctypes module and I admit I have not worked much
with dlls. However, I have given it a try and couldn't make it work.
I have a delphi dll and I read the thread on this, but the argument of
one function is a string and I cannot reverse this, so what am I to do
about the error:
cd c:/RefEqns/C, C++, Matlab, Simulink and Dymola/python/
\python22\python example.py
Traceback (most recent call last):
File "example.py", line 3, in ?
RefrigC.SetRNumber("R134")
ValueError: Procedure probably called with too many arguments (4 bytes in excess)
The code is:
import ctypes
RefrigC=ctypes.windll.RefrigC
RefrigC.SetRNumber("R134")
RefrigC.GetRNumber(AName)
print AName
which should correspond to
#include <stdio.h>
#include <refrigc.h>
void main()
{
char AName[200];
double ps,ts,ss,vs,tsnew;
SetRNumber("R134a");
GetRNumber(AName);
printf("Refrigerant : %7s\r\n",AName);
printf("%25s\r\n","-------------------------");}
The dll I try to run is in refeqns on
http://www.et.dtu.dk/WinDali/Files/RefEqns_3.10.ZIP
tia,
Brian
More information about the Python-list
mailing list