Callback Python procedure from Delphi DLL

D

durumdara

Hi!

I have a component, and a tool in Delphi.
I wanna call it from Python.

I can implement all things I need into a Delphi generated DLL.
It is ok, I can use this DLL from Python, but the DLL procedure needs a
callback procedure to return the partially output, and needs a python
passed variable to check terminate/abort signal.

For example:
procedure ProcessFiles(InputFiles : string; CallBackProc:
????????????????????????); export;
begin
....
CallBackProc(ProcessedFiles, Percentage, NeedToAbort);
if NeedToAbort then Exit;
....
end;


def CallBackProc(ProcessedFiles, Percentage, NeedToAbort):
...

But I don't know, how to call back this procedure, and how to pass
variables.

The other way is a ActiveX.
This time I don't load the DLL, I only construct the Delphi based Com
Object, and I start the process.

But in this way I also don't know how to implement the callback, because
the main code uses callback events, and I need to use too...

Thanks for every usable help!
dd
 
D

Diez B. Roggisch

Hi!

I have a component, and a tool in Delphi.
I wanna call it from Python.

I can implement all things I need into a Delphi generated DLL.
It is ok, I can use this DLL from Python, but the DLL procedure needs a
callback procedure to return the partially output, and needs a python
passed variable to check terminate/abort signal.

For example:
procedure ProcessFiles(InputFiles : string; CallBackProc:
????????????????????????); export;
begin
....
CallBackProc(ProcessedFiles, Percentage, NeedToAbort);
if NeedToAbort then Exit;
....
end;


def CallBackProc(ProcessedFiles, Percentage, NeedToAbort):
...

But I don't know, how to call back this procedure, and how to pass
variables.

The other way is a ActiveX.
This time I don't load the DLL, I only construct the Delphi based Com
Object, and I start the process.

But in this way I also don't know how to implement the callback, because
the main code uses callback events, and I need to use too...

Thanks for every usable help!

ctypes allows to create callbacks. See the module-docs.

Diez
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top