473,696 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.cx x
D:\DATA\zeisel\ vc\python\stati c\testerl\teste rl_wrap.cxx(793 ) : warning
C4273: 'Py_Main' : inconsistent dll linkage. dllexport assumed.
D:\DATA\zeisel\ vc\python\stati c\testerl\teste rl_wrap.cxx(799 ) : warning
C4273: 'PyImport_Initt ab' : inconsistent dll linkage. dllexport assumed.
Linking...
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initimp
testerl_wrap.ob j : error LNK2001: unresolved external symbol _PyMarshal_Init
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initzipimport
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initxxsubtype
testerl_wrap.ob j : error LNK2001: unresolved external symbol _inititertools
testerl_wrap.ob j : error LNK2001: unresolved external symbol _init_random
testerl_wrap.ob j : error LNK2001: unresolved external symbol _init_hotshot
testerl_wrap.ob j : error LNK2001: unresolved external symbol _init_weakref
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initxreadlines
testerl_wrap.ob j : error LNK2001: unresolved external symbol _init_codecs
testerl_wrap.ob j : error LNK2001: unresolved external symbol _init_locale
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initpcre
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initcPickle
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initcStringIO
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initthread
testerl_wrap.ob j : error LNK2001: unresolved external symbol _inittime
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initstruct
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initstrop
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initsha
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initsignal
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initrotor
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initrgbimg
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initregex
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initoperator
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initnt
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initmd5
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initmath
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initimageop
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initgc
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initerrno
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initcmath
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initbinascii
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initaudioop
testerl_wrap.ob j : error LNK2001: unresolved external symbol _initarray
testerl_wrap.ob j : error LNK2001: unresolved external symbol
_PyImport_Initt ab
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 2498

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

Similar topics

2
1745
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 extension. Is there a 3rd party library of extension helpers that assist in representing c-types between Python and c? Are there any tips and tricks? Here are some specific scenarios I am running into. 1) Refrencing and derefrencing: For...
12
3155
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 an integer. However, as soon as the function is complete, I get a segfault and the interpreter dies. If I run Python interactively, just calling the function causes a segfault. If I'm running a script, I can actually print out the return...
1
2129
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 how things are done in Objects/listobject.c, and it appears tha there are a couple of ways to do it and I'd like to get some opinions on what's the best way. As I see it, here are my options (please correct me if I'm wrong):
9
2548
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 could create a class for each structure, but I'm not sure how to get the data back and forth. The example the "Extending and Embedding the Python Interpreter" manual has examples of passing strings and ints using PyArg_ParseTupleAndKeywords(), but...
4
3679
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. If i compile it as release version, I've of course no chance to set a breakpoint. If I compile as debug I get the Error-window: .... missing MSVCR71D.dll ...
1
1920
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' distribution option is deprecated; use 'license' warnings.warn(msg) running build running build_ext building '_pcapmodule' extension Traceback (most recent call last):
5
1333
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 very appreciated if anyone could tell me what I've done wrong. First a short description of what I've done. The extension just wraps
0
1004
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 I cannot find any complete demo example of a C function taking as an argument a Python function defined by the user. What I am trying to do is to pass a class method as an argument of a function defined in a C extension:
2
3608
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 20070105 (Red Hat 4.1.1-52). I used following commands to build C++ extension: # swig -c++ -python edit_distance.i # c++ -c edit_distance.c edit_distance_wrap.cxx edit_distance.cpp -I.
0
8597
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9148
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9012
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8880
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8853
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5857
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4357
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2319
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.