Re: callback from C DLL returning an int [SEC=PERSONAL]
"Andrew MacIntyre" <[email protected]> Sun, 17 Jul 2011 23:31:10 +0000
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <A1E4E9D08D14924498E135FB4441EE8D07196F59@act01exmbx01vp.internal.govt> |
From: RayS > As it turns out, the DLL did have a conflict in the declarations; all the functions > were compiled using __cdecl while the set_callback function parameter requires > a pointer to a __stdcall function type. It will be recompiled using the __stdcall > calling convention for all functions, which should solve the issue. > Apparently, since the cdecl DLL expects all calling function to remove the > parameter from the stack, and the mixed in stdcall declared callback removed > parameters itself, the stack was not in a good state and Windows would shut > the process down - when the function exited the caller and called both had > popped the stack. Messy. Your code may well have worked though, if you'd declared the callback as WINFUNCTYPE rather than CFUNCTYPE upon finding out that the callback was __stdcall. Good to have a resolution, anyway. -------------------------> "These thoughts are mine alone!" <--------- Andrew MacIntyre Operations Branch tel: +61 2 6219 5356 Communications Infrastructure Division fax: +61 2 6253 3277 Australian Communications & Media Authority email: [email protected] http://www.acma.gov.au/ NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. ------------------------------------------------------------------------------ AppSumo Presents a FREE Video for the SourceForge Community by Eric Ries, the creator of the Lean Startup Methodology on "Lean Startup Secrets Revealed." This video shows you how to validate your ideas, optimize your ideas and identify your business strategy. http://p.sf.net/sfu/appsumosfdev2dev