extending python: c++ problem

Torsten Hörmann torsten.hoermann at telekom.de
Fri Mar 31 12:09:28 CEST 2000

Fredrik Lundh schrieb in Nachricht ...
>name mangling problems?
>using "nm" to figure out what happens to you "initmod" function
>might give you some clues...  (maybe iostream.h

the output from "nm -A mod.sl" with the include statement version includes
all symbols (and some more) that are included in the lib without the include
iostream.h (-> down i have inserted the two nm-outputs)

>the README and Misc/HPUX-Notes contain additional information
>on building shared libraries under HPUX:
>    HP-UX: Please read the file Misc/HPUX-NOTES for shared libraries.
>    When using threading, you may have to add -D_REENTRANT to the
>    OPT variable in the top-level Makefile; reported by Pat Knight
>    this seems to make a difference (at least for HP-UX 10.20)
>    even though config.h defines it.
>    There are two important points.  First, the python executable must be
>    linked with the -E option to explicitly export all symbols.  This
>    works with the vanilla interpreter, but I am not sure how friendly it
>    will be when I try to embed the interpreter in a larger application.
>    It may be necessary to hand tune the exports using the -e option.
>    Anyway, the additional flag to $(CC) is "-Wl,-E", which passes the -E
>    flag to the compiler.  My link line (from an actual run) looks like
>    this:
>        cc config.o -Wl,-E libModules.a  ../Python/libPython.a
>        ../Objects/libObjects.a ../Parser/libParser.a   -lm  -ldld
>        -o python
>    [Guido's note: as of Python 1.5, replace the four libraries with
>    ../libpython$(VERSION).a]
>    Second, the dynamic module must be compiled with the +z option to make
>    it position independent and then linked into a shared library:
>        ld -b -o <modName>module.sl <object list>
>    The -b tells the linker to produce a shared library.
>hope this helps!

problem: i've got python from a sd-package for hpux, compiled with the cc
and without sources/makefiles. now i will install the gcc and compile the
python sources on the machine, because we do not have a working cc and with
the aCC the compiling process (of python) stops with many error messages.
lets see.

thanks for you hints


#(without include):

Symbols from mod.sl:

Name                    Value   Scope  Type    Subspace

mod.sl:DS$testmod   |1073746008|static|data   |$DATA$
mod.sl:M$3$mod_getsub__FP7_objectT1|1073746048|static|data   |$SHORTDATA$
mod.sl:M$6$initmod  |1073746056|static|data   |$SHORTDATA$
mod.sl:Py_InitModule4|          |undef |code   |
mod.sl:Py_InitModule4|      4756|uext  |stub   |
mod.sl:SD$testmod   |1073746064|static|data   |$SHORTDATA$
mod.sl:_Py_NoneStruct|          |undef |data   |
mod.sl:initmod      |      4732|extern|entry  |
mod.sl:initmod      |      4780|extern|code   |$CODE$
mod.sl:mod_getsub__FP7_objectT1|      4588|static|entry  |$CODE$
mod.sl:mod_getsub__FP7_objectT1|      4636|static|entry  |$CODE$
mod.sl:printf       |          |undef |code   |
mod.sl:printf       |      4612|uext  |stub   |
mod.sl:static___soa_testmod_cpp_|1073746040|static|data   |$DATA$CDTORC1$
mod.mn: END

#(with include iostream.h):

Symbols from mod.sl:

Name                    Value   Scope  Type    Subspace

mod.sl:DS$testmod   |1073746048|static|data   |$DATA$
mod.sl:M$5$mod_getsub__FP7_objectT1|1073746096|static|data   |$SHORTDATA$
mod.sl:M$8$initmod  |1073746104|static|data   |$SHORTDATA$
mod.sl:Py_InitModule4|          |undef |code   |
mod.sl:Py_InitModule4|      5392|uext  |stub   |
mod.sl:SB$testmod   |1073746120|static|data   |$SHORTBSS$
mod.sl:SD$testmod   |1073746112|static|data   |$SHORTDATA$
mod.sl:_Py_NoneStruct|          |undef |data   |
mod.sl:__ct__13Iostream_initFv_1|          |undef |code   |
mod.sl:__ct__13Iostream_initFv_1|      5508|uext  |stub   |
mod.sl:__curStaticObject|          |undef |data   |
mod.sl:__dt__13Iostream_initFv|        -4|uext  |stub   |
mod.sl:__dt__13Iostream_initFv|          |undef |code   |
mod.sl:__sinit_testmod_cpp___Fv|      5484|static|entry  |$CODE$
mod.sl:__sinit_testmod_cpp___Fv|      5528|static|entry  |$CODE$
mod.sl:do_ipfx__7istreamFi|          |undef |code   |
mod.sl:do_ipfx__7istreamFi|      4956|uext  |stub   |
mod.sl:initmod      |      5368|extern|entry  |
mod.sl:initmod      |      5416|extern|code   |$CODE$
mod.sl:ipfx__7istreamFi|      4976|extern|code   |$CODE$
mod.sl:mod_getsub__FP7_objectT1|      5224|static|entry  |$CODE$
mod.sl:mod_getsub__FP7_objectT1|      5272|static|entry  |$CODE$
mod.sl:printf       |          |undef |code   |
mod.sl:printf       |      5248|uext  |stub   |
mod.sl:static___soa_testmod_cpp_|1073746080|static|data   |$DATA$CDTORC1$
mod_inc.nm: END


More information about the Python-list mailing list