Using CTypes Module

John Machin sjmachin at lexicon.net
Mon Feb 3 05:08:02 EST 2003


"Brandon Philips" <brandon at sporknet.cjb.net> wrote in message news:<bSj%9.29201$zF6.2060859 at bgtnsc04-news.ops.worldnet.att.net>...
> Hello All,
> 
> Really simple question (I think).
> I have compiled some code in C++ as a dll.  I tested it with a simple test
> program and it does what it is supposed to.  I have played with the Ctypes
> module and I can call kernel32 functions and etc like are in the examples
> but I cannot call my dll functions... how do I go about doing that? (I am
> not a python developer, I am doing this because my group wants my software
> to be scriptable.)
> 

>   File "C:\Python22\Lib\site-packages\ctypes.py", line 126, in __getattr__
>     func = _DynFunction(name, self, FUNCFLAG_CDECL)
> ValueError: function 'writePacket' not found
> >>>
> 
> ninebutton.dll is my dll and writePacket(int, int) is my function.  What did
> I do wrong?

Use the Dependency Walker program to inspect your DLL and find out
what the name of your function *really* is.




More information about the Python-list mailing list