C++-Extension
Gordon McMillan
gmcm at hypernet.com
Mon Jan 31 14:30:39 EST 2000
Tilo Schwarz wrote:
>
> the
>
> Extending and Embedding the Python Interpreter
>
> reference says, that (1.11)
>
> "If the main program (the Python interpreter) is compiled
> and linked by the C compiler, global or static objects with
> constructors cannot be used. This is not a problem if the main program
> is linked by the C++ compiler"
>
> Does that mean, C++-Extension are not "portable" - means, that I need
> a C++-linked python interpreter to load my C++-Extension? Not
> portable, because on a different platform I don't know if there is a
> C++-linked python interpreter and some code might use global or static
> objects with constructors. Am I right? (Hopefully not)
It is _definitely_ not portable to write a C++ extension that
uses static objects. It is only _quasi_ portable to write a C++
extension without them.
> I'm asking, because I get the following error message:
>
> > python
> Python 1.5.2 (#1, Jul 23 1999, 06:38:16) [GCC egcs-2.91.66
> 19990314/Linux (egcs- on linux2
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import _CircleDetector
> Traceback (innermost last):
> File "<stdin>", line 1, in ?
> ImportError: ./_CircleDetectormodule.so: undefined symbol: cerr
> >>>
That's a library problem. You probably want to get the C++ std
lib statically linked to your .so.
- Gordon
More information about the Python-list
mailing list