Python COM and Delphi callback

L

Larry Bates

I have a Python COM object working. I want to pass to it
a Delphi callback function (showing progress) that I can
call periodically. I've Googled until I'm cross-eyed and
I'm getting nowhere. Anybody out there that could give
me a push in the right direction.

I tried passing pointer to my callback function using
@ operator in Delph, but when I compile Delphi complains.

Here is a snip of my Delphi code:

function Callback(total: integer; position: integer): boolean; stdcall;
begin
WriteLn('In Callback, total=' + IntToStr(total) +
' position=' + IntToStr(position));
result := True;
end;

..
.. In program
..
//
// Set callback function in wsAPI to be called for each block
// that is uploaded. oC contains instance of COM object and
// works perfectly. oC has a method called WSset_callback that
// expects a callback function as an argument. I have the
// callback working perfectly in pure-Python code.
//
oC.WSset_callback(@Callback);

When I compile I get:

[Pascal Error] wsAPICOM.dpr(151) E2281 Type not allowed in Variant
Dispatch call.

Thanks in advance for any assistance.

Regards,
Larry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top