472,119 Members | 1,428 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,119 software developers and data experts.

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
0 2372

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 | 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 | last post: by
2 posts views Thread by mk | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.