2006年07月31日 星期一 13:14
用C写一个小函数, /*filetest.c*/ #includechar * disp() { static char buf[24]; FILE * fp; fp=fopen("1.txt","r"); fread(buf,1,23,fp); buf[23]='\0'; fclose(fp); return buf; } 用swig转换成python可调用的函数。 在python环境下调用filetest.disp() 运行正常, 但在mod_python下用publisher调用却无效。apache日志提示段错误( signal Segmentation fault (11)) 请教原因。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060731/19fd41cb/attachment.html
2006年07月31日 星期一 13:24
在06-7-31,spr liu <sprliu at gmail.com> 写道: > > 用C写一个小函数, > /*filetest.c*/ > #include> > char * disp() > { > static char buf[24]; > FILE * fp; > fp=fopen("1.txt","r"); > fread(buf,1,23,fp); > buf[23]='\0'; > fclose(fp); > > return buf; > } > > 用swig转换成python可调用的函数。 > 在python环境下调用filetest.disp() 运行正常, > 但在mod_python下用publisher调用却无效。apache日志提示段错误( signal Segmentation fault > (11)) > 请教原因。 > > > 另:filetest.i内容如下: %module filetest %{ extern char * disp(); %} extern char * disp(); 1.txt里面是一句文本信息,长度23。 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060731/69d29592/attachment.htm
2006年07月31日 星期一 13:38
Ò»°ëÕâÖÖÇé¿öÊÇÓÉÓÚϵͳ»·¾³Ôì³ÉµÄ ¿´¿´apacheµÄÓû§µÄ»·¾³¸úrootÓÐʲô²»Í¬£¬°üÀ¨PATH,LD¿ªÍ·µÄһϵÁбäÁ¿µÈ£¬»¹ÓÐ ÎļþµÄÊô×éȨÏÞµÈ Best Regards, Zachary Wu (Îâ°~ÀÚ) Software Engineer, Enterprise Content Management FVT, IBM China Software Development Lab Tel: +86 10 82782244-3235. Fax: 82782244-2886 Tie Line: 915-2244-3235 Internet: xiaoleiw at cn.ibm.com Notes ID: Xiao Lei Wu/China/Contr/IBM at IBMCN Address: 8/F, Block A, Power Creative Building, No.1, East Road, Shang Di, Beijing 100085, P.R. China python-chinese-bounces at lists.python.cn дÓÚ 2006-07-31 13:14:56: > ÓÃCдһ¸öСº¯Êý£¬ > /*filetest.c*/ > #include> > char * disp() > { > static char buf[24]; > FILE * fp; > fp=fopen("1.txt","r"); > fread(buf,1,23,fp); > buf[23]='\0'; > fclose(fp); > > return buf; > } > > ÓÃswigת»»³Épython¿Éµ÷Óõĺ¯Êý¡£ > ÔÚpython»·¾³Ïµ÷ÓÃfiletest.disp() ÔËÐÐÕý³££¬ > µ«ÔÚmod_pythonÏÂÓÃpublisherµ÷ÓÃÈ´ÎÞЧ¡£apacheÈÕÖ¾Ìáʾ¶Î´íÎó£¨ signal > Segmentation fault (11)£© > Çë½ÌÔÒò¡£ > > _______________________________________________ > python-chinese > Post: send python-chinese at lists.python.cn > Subscribe: send subscribe to python-chinese-request at lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060731/d3176c75/attachment.html
Zeuux © 2025
京ICP备05028076号