[Distutils] Dist utils library problem?

Glenn Pierce glennpierce at connectfree.co.uk
Tue May 17 12:13:01 CEST 2005

Sorry if this is not the correct mailing list.

I have a question about writing a portable setup.py script for distutils.

I have a directory structure like this.

   |          |------ FreeImage.h
   |          |------libfreeimage-3.7.0.so
   |          |------libfreeimage.a
   |          |------FreeImage.lib
   |          |------FreeImage.dll

I am wrapper a c++ library and have the library files for linux and windows 
installed under Dist/.
I want to create a setup file that works on both unix and Windows but I 
am having trouble with windows.
My setup.py file is like the following:

from distutils.core import setup, Extension

ext_module = Extension('freeimagewrapper',
                    define_macros = [('MAJOR_VERSION', '3'),
                                     ('MINOR_VERSION', '7')],
                    include_dirs = ['../../Source/'],
                    libraries = ['FreeImage'],     
                    sources = ['freeimagemodule.c'])

setup (name = 'freeimage',
       version = '1.0',
       author = 'Glenn Pierce',
       description = 'Python wrapper for the freeimage library',
       ext_modules = [ext_module])

I am getting link errors.
Visual studio can find ../../Dist/FreeImage.lib
but I don't think it can find FreeImage.dll

The errors are like:

Creating library build\temp.win32-2.4\Release\freeimagewrapper.lib and 
freeimagemodule.obj : error LNK2019: unresolved external symbol 
_FreeImage_Unload referenced in function _destroy

Where should I be placing the FreeImage.dll file ?

I have read the distutils guide but wasn't clear on the library section 
for ext modules.

Thanks for any help.


More information about the Distutils-SIG mailing list