开发者

try to embed my C code in PHP script

I am learnin开发者_JAVA百科g how to use SWIG, and I am writing a php wrapper for a C library. The extension successfully compiles, but when I try to call the function I get this error:

php: symbol lookup error: /usr/lib/php5/20090626+lfs/fact.so: undefined symbol: fact


Your problem is probably due to a mismatch in the name of the module (see %module, or passed on the command line) and the name of the .so file you are generating.

PHP, or any system that accepts loadable binary modules, is going to make certain assumptions about the name of the entry point into the library it is trying to load. PHP seems to be assuming that the file name (fact.so) is going to contain a function called "fact".

When you run SWIG, explicitly setting the module name to "fact" will probably solve your problem. If not, posting the generated SWIG source file could help us debug your problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜