A
achrist
I'm aving some trouble getting callbacks from a Delphi DLL back to
python working through ctypes.
The call from python to the DLL works fine.
In the Delphi(5) code:
type
TCallbackFunc = function(x: Integer): Integer; stdcall;
var
Callback1: TCallbackFunc;
CallbackB: TCallbackFunc;
In the Python code:
cFunctionType = ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.c_int)
pyCallback1 = cFunctionType(pyFunc1)
myDLL.SetCallback1(pyCallback1)
Then I call the DLL, eg:
myDLL.BigFunc()
And that runs fine, and the callback works fine until it returns.
At that point the python callback function executes:
answer = 0
return answer
or:
answer = 1
return answer
At this point, the enterprise fails, with an error message of
"Access violation at address 00959D2C. Write of address 00000000",
or "Access violation at address 00959D2C. Write of address 00000001"
where the 8-digit number at the end of the message is the same as
the value returned by the callback function.
I think that I'm close, but I don't have a clue.
TIA for any ideas.
Al
python working through ctypes.
The call from python to the DLL works fine.
In the Delphi(5) code:
type
TCallbackFunc = function(x: Integer): Integer; stdcall;
var
Callback1: TCallbackFunc;
CallbackB: TCallbackFunc;
In the Python code:
cFunctionType = ctypes.WINFUNCTYPE(ctypes.c_int,ctypes.c_int)
pyCallback1 = cFunctionType(pyFunc1)
myDLL.SetCallback1(pyCallback1)
Then I call the DLL, eg:
myDLL.BigFunc()
And that runs fine, and the callback works fine until it returns.
At that point the python callback function executes:
answer = 0
return answer
or:
answer = 1
return answer
At this point, the enterprise fails, with an error message of
"Access violation at address 00959D2C. Write of address 00000000",
or "Access violation at address 00959D2C. Write of address 00000001"
where the 8-digit number at the end of the message is the same as
the value returned by the callback function.
I think that I'm close, but I don't have a clue.
TIA for any ideas.
Al