Calling C Function Pointers from Python

Janos Blazi jblazi at vipsurf.de
Sun Jul 30 08:27:09 EDT 2000


Neil Hodgson <neilh at scintilla.org> schrieb in im Newsbeitrag:
zUUg5.16220$4p3.129370 at news-server.bigpond.net.au...
> > Can somebody tell me, how a dll call from Python works on principal? Let
> us
> > suppose I'd like to something like caldll. Where should I start. Which
> > Python "primitives" have I to use?
>
>    I can explain how to use calldll. If you want to know how to write your
> own extensions then you should read the "Extending and Embedding the
Python
> Interpreter" document which is part of the standard documentation package
> and should have been installed when you installed Python.
>
>    calldll is a low level Python extension libary which contains functions
> for creating buffers, loading DLLs, finding the address of functions
within
> the loaded DLLs, and calling the functions. On top of that is a higher
level
> windll module that makes it more convenient to call.
>
>    Here is a sequence of calls:
>
> import calldll
> kernel32 = calldll.load_library('kernel32.dll')
> Beep = calldll.get_proc_address(kernel32, "Beep")
> ret = calldll.call_foreign_function(Beep,'ll','l',(1000,500))
>
>    Neil

Thx. Can you (additionally) explain the meaning of 'll' and 'l' and give an
example where I receive a return value (a double for example)?




-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----



More information about the Python-list mailing list