[Python-Dev] cffi in stdlib (original) (raw)

Paul Moore p.f.moore at gmail.com
Wed Feb 27 21:31:45 CET 2013


On 27 February 2013 19:26, Paul Moore <p.f.moore at gmail.com> wrote:

On 27 February 2013 19:08, Armin Rigo <arigo at tunes.org> wrote:

That's not correct: you can't indeed give the calling convention, but it is not needed for the common case. What is not supported is only Python-defined callbacks using the Windows-specific convention --- as documented, there is a workaround for that case. OK, that's cool. As I said, I really need to actually experiment with cffi - this thread has certainly made me want to do so.

Actually, looking at the cffi documentation, I can't see how I'd translate the following very simple example of something I do quite a lot in ctypes:

from ctypes import windll MessageBox = windll.User32.MessageBoxW MessageBox(0, "Hello, world!", "Title", 0)

Note - I wrote this from memory, I honestly don't know without looking it up the precise argument types for MessageBoxW - and even if I did, I suspect they would all be macros from windows.h. I don't want to invoke the C compiler by using verify, and I don't see in the docs how I'd get the macro definitions any other way.

If anyone could show me a cffi equivalent, I'd be very grateful. Paul



More information about the Python-Dev mailing list