By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,941 Members | 1,753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,941 IT Pros & Developers. It's quick & easy.

Python COM and Delphi callback

P: n/a
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
May 2 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.