473,748 Members | 7,571 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 2504

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

Similar topics

2
1748
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
3159
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
2132
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
2552
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
3684
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
1922
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
1335
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
1006
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
3610
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
8830
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
9372
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...
0
9247
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...
0
8243
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
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
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.