Re: [Q] ctypes callbacks with Delphi

achrist_at_easystreet.com
Date: 10/19/03


Date: Sat, 18 Oct 2003 22:24:19 -0700

Andrew MacIntyre wrote:
>
> On Fri, 17 Oct 2003 achrist@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



Relevant Pages

  • Re: Callback Python procedure from Delphi DLL
    ... I wanna call it from Python. ... I can implement all things I need into a Delphi generated DLL. ... But in this way I also don't know how to implement the callback, ...
    (comp.lang.python)
  • Callback Python procedure from Delphi DLL
    ... I wanna call it from Python. ... I can implement all things I need into a Delphi generated DLL. ... callback procedure to return the partially output, and needs a python passed variable to check terminate/abort signal. ...
    (comp.lang.python)
  • Re: Importing a 3rd Party windows DLL for use within th Python
    ... I have recently started learing how to code/script in Python which I ... necessary to access this DLL and treat it like any other pyd library? ... For a first stab, I recommend using ctypes. ... You may eventually want to write an extension module. ...
    (comp.lang.python)
  • Re: Accessing a dll from Python
    ... > Can someone give me lights on how can I deal with dlls from python? ... > My main purpose is to get access to a Unitech PT600 Bar Code system. ... > Python, so I need a way to use the same dll, or a C library. ... I tried the ctypes module. ...
    (comp.lang.python)
  • Re: re - Question about pyFMOD importing
    ... > Were you able to hack this one? ... I guess that the library that ctypes looks for is the ... DLL required for FMOD. ... The library search path should include the current path ...
    (comp.lang.python)