extending python with a C-written dll

Jean-Baptiste PERIN jb_perin at yahoo.fr
Mon Dec 20 11:05:13 EST 2004


Grant Edwards a écrit :

> On 2004-12-20, Jean-Baptiste PERIN <jb_perin at yahoo.fr> wrote:
> 
> 
>>>>I'm trying to make a windows dll reachable from a python script..
>>>
>>>FWIW, you can call dll's using the ctypes modules without
>>>mucking around in C.  There may be performance reasons to build
>>>a "real" python module, but I haven't run across them yet.
>>
>>Not really a performance reason .. but mainly because I have a
>>huge code produced in C and no time to port it in python ..
>>Moreover .. I need the python program to interact with the C
>>code ..(perfom calls to dll-defined functions)
>>
>>I don't know ctypes module .. do you really think it can help?
> 
> 
> It lets you easily call functions in DLLs.
> 
> 
>>Do you have a link to quickly learn about it ?
> 
> 
> http://starship.python.net/crew/theller/ctypes/
> http://starship.python.net/crew/theller/ctypes/tutorial.html
> 
> 
>>The only thing I found is :
>>http://www.python.org/workshops/1994-11/BuiltInClasses/BuiltInClasses_5.html
> 
> 
> I think that is unrelated.
> 

OK .. ctypes looks great .. and I plan to use it for futur purposes

The fact is that the python interpreter I use is not a standard one
It is a python interpreter delivered within a software named Blender.
I don't know whether it is possible or not to add ctypes to it ..(I 
don't even have a python shell to perform the setup)

I'm sure it is possible to use dll-built with it ..
So please .. can you tell me where I can find Py_BuildValue and 
Py_InitModule4 to link with ?






More information about the Python-list mailing list