开发者

try to embed my C code in PHP script

开发者 https://www.devze.com 2023-02-20 14:30 出处:网络
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:

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

精彩评论

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