Monday, December 30, 2013

How did I solve frequent crashing of libjpeg?

Recently I was using libjpeg to support my program but as most people met, it crashed frequently. At first time it crashed at jpeg_read_header() and I unexpectedly linked to another library solving this crash but met it again at jpeg_finish_decompress(). Although googling it hardly online, I got little help. Today, I used libjpeg-turbo (jpeg-static.lib) and suddenly found it working! What an exciting moment!

Platform: Windows XP professional
Compiler: Visual Studio 2010 C++
File: rw_dct.c, setup.py, rw_dct_test.py (I need to compile and get PYD file)

# setup.py
#!/usr/bin/env python2
import os
from distutils.core import setup, Extension
from distutils.sysconfig import get_python_lib

numpy_import = os.path.join(get_python_lib(), 'numpy', 'core', 'include')

mod_rw_dct = Extension('rw_dct',
                       sources=['rw_dct.c'],
                       libraries=['jpeg-static'],
                       include_dirs=[numpy_import])

setup(name='Get Pyd',
      version='0.1',
      description='Compiling Pyd file test',
      license='GNU GPLv3',
      ext_modules=[mod_rw_dct])

No comments:

Post a Comment