Importing DLLs

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Aug 20 09:33:00 CEST 2007


En Wed, 15 Aug 2007 14:20:26 -0300, Corbitt, Kyle <kcorbitt at api.com>  
escribi�:

> I'm running Linux with Python 2.3.  I have a C shared object file (*.so)  
> and I need to be able to call its functions from within Python.  I have  
> found a couple of Python modules that allow me to do this (dl, ctypes)  
> but unfortunately I am only able to get them to return integers, even  
> for function calls that I KNOW the library is supposed to return other  
> types for.  I need the library to be able to return doubles, 2D arrays

Use the ctypes module. Read the tutorial - you have to set the restype  
attribute on functions.

-- 
Gabriel Genellina




More information about the Python-list mailing list