[Q] ctypes callbacks with Delphi

achrist at easystreet.com achrist at easystreet.com
Sun Oct 19 01:24:19 EDT 2003


Andrew MacIntyre wrote:
> 
> On Fri, 17 Oct 2003 achrist at easystreet.com wrote:
> 
> > I'm aving some trouble getting callbacks from a Delphi DLL back to
> > python working through ctypes.
> 
> I suggest that this question will be more visible on the ctypes mailing
> list.  I vaguely recall a question along these lines some time ago, so
> viewing the list archives might be useful.
> 

I've been over those ASPN list archives as best I can, and I don't
see anything that solves this problem.  However, trying to
search the lists is a little tricky.  I did a search on 'callback'
and it shows me results 1-20, which don't show me anything that
I think will help, and clicking on '21-40' gives me advertising and
no more messages. IDK.

When I search for 'Delphi', nothing comes up.  This can't be a Delphi
problem, can it? Delphi can't be that broken, can it?

When I search for the terms in the error message that I get, 'Access 
Violation' and 'write address', I don't see a solution obviously
anywhere.  The ASPN pages load very slowly on my machine over dial-up,
so it's no fun hunting around for something that you don't know is
there.

I see that I have to subscribe to the list to post a message.  So, I
try to subscribe and go to the ASPN page to subscribe, and they list
about 40 groups, but no ctypes-users.   Looks like subscriptions
to this one are not currently available to such as me.

The ctypes tutorial makes this look very easy, and I think that I'm
doing what it shows, and it almost works, but not 100%.  IDK.

The unit tests that come with ctypes have a test for callbacks from
a DLL, so I try to look at that to see what goes on in the DLL to 
see if I can write my DLL the same way.  But they don't include source
for the DLL.  They don't even call a real DLL.  They test ctypes with
a synthetic DLL of some kind created by a ctypes CDLL macro.  So the
unit test only shows that ctypes can talk to itself, not maybe a real
DLL.  IDK.

If anyone is using ctypes with called-back functions written in python
returning (simple integer) values back to a DLL written in C or Delphi,
such DLL called from python through ctypes,  I'd sure like to see
what the python and C or Delphi code that work together look like --
how the identity of the called-back function is passed to the DLL and
how the called-back function sends back its return value.  I'm
trying to follow the tutorial, which looks very easy, but I've not got
it right.

TIA and thanks for your help,


Al




More information about the Python-list mailing list