467,080 Members | 951 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,080 developers. It's quick & easy.

Q: Static extension of Python using SWIG

I want to build a static extension of Python using SWIG and VC++ 6.0 as
described in http://www.swig.org/Doc1.3/Python.html#n8 for gcc.

My file is testerl.i:

=========================
%module testerl

extern int hz(int i);

%include embed.i
==========================

I essentially use the same settings as described in
http://www.swig.org/Doc1.3/Python.html#n12 for dynamic extensions,
in particular I link python23.lib. (SWIG is 1.3.21, Python is 2.3.4).
Additionally I define the preprocessor macro STATIC_LINKED and the
preprocessor inclide path Python-2.3.4\PC (for config.c). I tried to
call swig with and without option c++.

Creating DLL works, but when linking for a statically linked version I
get the warnings and error messages added below - any idea what is missing?

Did anyone succeed in building a statically extend python using VC?
Which version?

Helmut

Linker error messages:
======================
testerl_wrap.cxx
D:\DATA\zeisel\vc\python\static\testerl\testerl_wr ap.cxx(793) : warning
C4273: 'Py_Main' : inconsistent dll linkage. dllexport assumed.
D:\DATA\zeisel\vc\python\static\testerl\testerl_wr ap.cxx(799) : warning
C4273: 'PyImport_Inittab' : inconsistent dll linkage. dllexport assumed.
Linking...
testerl_wrap.obj : error LNK2001: unresolved external symbol _initimp
testerl_wrap.obj : error LNK2001: unresolved external symbol _PyMarshal_Init
testerl_wrap.obj : error LNK2001: unresolved external symbol _initzipimport
testerl_wrap.obj : error LNK2001: unresolved external symbol _initxxsubtype
testerl_wrap.obj : error LNK2001: unresolved external symbol _inititertools
testerl_wrap.obj : error LNK2001: unresolved external symbol _init_random
testerl_wrap.obj : error LNK2001: unresolved external symbol _init_hotshot
testerl_wrap.obj : error LNK2001: unresolved external symbol _init_weakref
testerl_wrap.obj : error LNK2001: unresolved external symbol _initxreadlines
testerl_wrap.obj : error LNK2001: unresolved external symbol _init_codecs
testerl_wrap.obj : error LNK2001: unresolved external symbol _init_locale
testerl_wrap.obj : error LNK2001: unresolved external symbol _initpcre
testerl_wrap.obj : error LNK2001: unresolved external symbol _initcPickle
testerl_wrap.obj : error LNK2001: unresolved external symbol _initcStringIO
testerl_wrap.obj : error LNK2001: unresolved external symbol _initthread
testerl_wrap.obj : error LNK2001: unresolved external symbol _inittime
testerl_wrap.obj : error LNK2001: unresolved external symbol _initstruct
testerl_wrap.obj : error LNK2001: unresolved external symbol _initstrop
testerl_wrap.obj : error LNK2001: unresolved external symbol _initsha
testerl_wrap.obj : error LNK2001: unresolved external symbol _initsignal
testerl_wrap.obj : error LNK2001: unresolved external symbol _initrotor
testerl_wrap.obj : error LNK2001: unresolved external symbol _initrgbimg
testerl_wrap.obj : error LNK2001: unresolved external symbol _initregex
testerl_wrap.obj : error LNK2001: unresolved external symbol _initoperator
testerl_wrap.obj : error LNK2001: unresolved external symbol _initnt
testerl_wrap.obj : error LNK2001: unresolved external symbol _initmd5
testerl_wrap.obj : error LNK2001: unresolved external symbol _initmath
testerl_wrap.obj : error LNK2001: unresolved external symbol _initimageop
testerl_wrap.obj : error LNK2001: unresolved external symbol _initgc
testerl_wrap.obj : error LNK2001: unresolved external symbol _initerrno
testerl_wrap.obj : error LNK2001: unresolved external symbol _initcmath
testerl_wrap.obj : error LNK2001: unresolved external symbol _initbinascii
testerl_wrap.obj : error LNK2001: unresolved external symbol _initaudioop
testerl_wrap.obj : error LNK2001: unresolved external symbol _initarray
testerl_wrap.obj : error LNK2001: unresolved external symbol
_PyImport_Inittab
Release/testerl.exe : fatal error LNK1120: 35 unresolved externals
Error executing link.exe.

testerl.exe - 36 error(s), 2 warning(s)
Jul 18 '05 #1
  • viewed: 2182
Share:

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Letbetter, Jason | last post: by
12 posts views Thread by Nathaniel Echols | last post: by
9 posts views Thread by timothy.williams@nvl.army.mil | last post: by
4 posts views Thread by Alexander Eisenhuth | last post: by
1 post views Thread by Grant Edwards | last post: by
5 posts views Thread by pythoncurious@gmail.com | last post: by
2 posts views Thread by mk | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.