473,408 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 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 2475

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Letbetter, Jason | last post by:
I'm creating Python extensions for several c/c++ components. I'm using swig to create the extensions. The biggest challenge so far is working with the c args between Python and the Python...
12
by: Nathaniel Echols | last post by:
I've written a function in C to perform protein sequence alignment. This works fine in a standalone C program. I've added the necessary packaging to use it in Python; it returns three strings and...
1
by: Steve Juranich | last post by:
I'm in the process of writing a few extension types, and there's one that I'd sort of like to have getitem, setitem, getslice, setslice functionality for. I've been looking through the docs and...
9
by: timothy.williams | last post by:
Hi. I trying to write an extension module to call some C libraries so I can use them in Python. Several of the library functions pass pointers to structures as arguments. I was thinking that I...
4
by: Alexander Eisenhuth | last post by:
Hi alltogether, I use ActivePython 2.4.1 , also the debug part from http://ftp.activestate.com/ActivePython/etc/ and VC 6.0 unter Windows XP. I can't figure out howto debug my c++ extension....
1
by: Grant Edwards | last post by:
I've been using the pylibpcap extension module for several years, but I can't get it to build under 2.4: $ python setup.py build /usr/lib/python2.4/distutils/dist.py:222: UserWarning: 'licence'...
5
by: pythoncurious | last post by:
Hi, I'm having a bit of trouble when writing a python extension. I can't seem to figure out what I did wrong. I tried to make a minimal example, but it's still quite a bit of code. It would be...
0
by: mauro | last post by:
Hi all, I am trying to wrap some C code using SWIG (win32, mingw). I am new to SWIG and to the Python/C API so what I am doing is looking at the examples and trying to fit them to my needs, but...
2
by: mk | last post by:
Hello, I'm having terrible problems building C++ extension to Python 2.4 using SWIG. I'd appreciate if somebody knowledgeable at the subject took a look at it. swig-1.3.29, g++ (GCC) 4.1.1...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.