AIX_python_c扩展问题

++ AIX_python_c扩展 文件: rel://files/exp.c

+++编译动态函数(失败) xlC_r -q64 -DNDEBUG -O -DTUXVERSION=8 -UTUXWS -I/usr/include -I/acct/bigzhu/python252/include/python2.5 -c exp.c -o exp.o

xlC_r -q64 -bI:/acct/bigzhu/python252/lib/python2.5/config/python.exp exp.o -o example.so -berok

出现报错:

import example Traceback (most recent call last): File “”, line 1, in ImportError: dynamic module does not define init function (initexample)

据说是因为使用了C++的编译,会导致python找不到初始化函数的作用 ++++改为cpp尝试(失败) xlC_r -q64 -DNDEBUG -O -DTUXVERSION=8 -UTUXWS -I/usr/include -I/acct/bigzhu/python252/include/python2.5 -c exp.cpp -o exp.o

xlC_r -q64 -bI:/acct/bigzhu/python252/lib/python2.5/config/python.exp exp.o -o example.so -berok

依然报错 ++++用xlc编译器(失败) xlc_r -q64 -DNDEBUG -O -DTUXVERSION=8 -UTUXWS -I/usr/include -I/acct/bigzhu/python252/include/python2.5 -c exp.cpp -o exp.o

xlc_r -q64 -bI:/acct/bigzhu/python252/lib/python2.5/config/python.exp exp.o -o example.so -berok

依然报错 ++++用gcc(失败) 测试 gcc -fpic -c -I/acct/bigzhu/python252/include/python2.5 exp.c gcc -shared -o example.so exp.o AIX的gcc安装有问题无法使用 ++++用c封装初始化函数(无必要) 初始化函数前加入:

extern “C” PYUTIL_API void rel://files/exp.cpp

xlC_r -q64 -DNDEBUG -O -DTUXVERSION=8 -UTUXWS -I/usr/include -I/acct/bigzhu/python252/include/python2.5 -c exp.cpp -o exp.o

xlC_r -q64 -bI:/acct/bigzhu/python252/lib/python2.5/config/python.exp exp.o -o example.so -berok

依然报错 ++++模拟tuxedo模块编译(成功) rel://files/example.cpp xlc_r -q64 -DNDEBUG -O -DTUXVERSION=8 -UTUXWS -I/usr/include -I/acct/bigzhu/python252/include/python2.5 -c example.cpp -o example.o

/acct/bigzhu/python252/lib/python2.5/config/ld_so_aix xlc_r -q64 -bI:/acct/bigzhu/python252/lib/python2.5/config/python.exp example.o -o example.so -berok

++++用xlC编译器?(成功) xlC_r -q64 -DNDEBUG -O -DTUXVERSION=8 -UTUXWS -I/usr/include -I/acct/bigzhu/python252/include/python2.5 -c example.cpp -o example.o

/acct/bigzhu/python252/lib/python2.5/config/ld_so_aix xlC_r -q64 -bI:/acct/bigzhu/python252/lib/python2.5/config/python.exp example.o -o example.so -berok tpcall动态库