Problems wrapping FreeImage with SWIG on win32

Riccardo rtrocca at inwind.it
Mon Mar 15 08:30:40 EST 2004


Hello, I'm trying to wrap FreeImage (freeimage.sf.net) through SWIG in
Python on Win32. I'm using VC6sp5.
I've tried both using the static library and the dynamic one, having
the same kind of problems: missing symbols.
I describe you the sequence:
I create a swig file like this one:

%module freeimage
%{
#include "FreeImage.h"
%}
const char *FreeImage_GetVersion();
const char *FreeImage_GetCopyrightMessage();

then I create the source file with:

swig -python -c++ -o pyFreeImage.cpp FreeImage.i

The setup.py file is:

setup(name="pyFreeImage",
version="0.0",
description="wrapper to FreeImage",
#packages=[''],
ext_modules=[Extension("_freeimage", ["pyFreeImage.cpp"],
libraries=["FreeImage"])]
)

So far so good.
When I launch the build the file compiles well but I've problems
during the link phase:

C:\Programmi\Microsoft Visual Studio\VC98\BIN\link.exe /DLL /nologo
/INCREMENTAL:NO /LIBPATH:C:\Python23\libs /LIBPATH:C:\Python23\PCBuild
FreeImage.lib /EXPORT:init_freeimage
build\temp.win32-2.3\Release\pyFreeImage.obj
/OUT:build\lib.win32-2.3\_freeimage.pyd
/IMPLIB:build\temp.win32-2.3\Release\_freeimage.lib
Creating library build\temp.win32-2.3\Release\_freeimage.lib and
object build\temp.win32-2.3\Release\_freeimage.exp
pyFreeImage.obj : error LNK2001: unresolved external symbol
_FreeImage_GetVersion
pyFreeImage.obj : error LNK2001: unresolved external symbol
_FreeImage_GetCopyrightMessage
build\lib.win32-2.3\_freeimage.pyd : fatal error LNK1120: 2 unresolved
externals
error: command '"C:\Programmi\Microsoft Visual
Studio\VC98\BIN\link.exe"' failed with exit status 1120

Given that VC finds the library (I use it in an application of mine
and it compiles well), and that the lib is the latest one,
pre-compiled, as found on sf.net,
what am I missing?

THanks for the help.

Riccardo



More information about the Python-list mailing list