[Numpy-discussion] OT? Distutils extension with shared libs

silva@lma.cnrs-m... silva@lma.cnrs-m...
Tue Jul 6 17:34:04 CDT 2010


More precisely, the constructor provides C source code to access data  
and metadata with files ReadIM{7,x}.{c.h}.
I wrote a tiny ctypes wrappers in order to have a object-oriented  
class in python that handling reading the data files written by the  
constructor software.

One issue is that ReadIM7.h includes zlib.h. On linux, it is easy to  
install zlib-dev package. All is simple, as it is installed in  
standard repertory. On windows of course no standards. How would you  
then proceed? Do I have to distribute zlib.h, and also zconf.h,  
zlib.lib, libz.a and libz.dll.a needed to get it work ? Or a simpler  
solution is to only distribute binaries on this platform ?

Other issue: with all these files in ./src, I have the following  
configuration:
     ext = Extension('_im7',
         sources=['src/ReadIM7.cpp', 'src/ReadIMX.cpp'],
         include_dirs=['src'],\
         libraries=['zlib',],\
         library_dirs=['src'],\
         define_macros=[('_WIN32', None), ('BUILD_DLL', None)], \
         extra_compile_args=['-ansi', '-pedantic', '-g', '-v'])

it builds a _im7.pyd file that ctypes is not able to load as it  
expects a _im7.dll file with
ctypes.cdll.loadlibrary('_im7')...

Is their a way to make distutils build a .dll file that could be  
loaded by ctypes ? or using distutils in such a way is not the right  
way to go ?
on linux, there is no trouble, distutils makes a _im7.so file that  
ctypes can easily load...

Thanks

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the NumPy-Discussion mailing list