[Q] ctypes callbacks with Delphi

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


I've tracked this down to some kind of an interaction between
ctypes and the GUI'S.

Python calls Delphi through ctypes.  Delphi opens a form on the
screen.  When Delphi calls back to python through ctypes, the
Delphi form is still open.  

If the called-back function in python uses its own dialog to
get the callback answers (I'm using wxPython), then the return
value back to the Delphi dll gets messed up and everything crashes
as previously described.  If the called back function figures
out a value without doing anything GUI, it works fine. 

I suppose that the source of this problem is something way deep
down in ctypes where it is handling threads or something, IDK.  

Tomorrow I'll try to figure out if exception handling code on the
Delphi side can at least catch the error.  If so, I'll communicate
the called-back's return value back to Delphi through a
callcallbackback function and everything might fly.  If Delphi
can't catch and recover from the error, I'm hurting. 

Too late to figure this out now.  Any guesses or alternative
contingency plans???


Al




More information about the Python-list mailing list