我需要将libnetcdf与PHP接口。 (谷歌代码上的php-netcdf已损坏)
这是netcdf.i:
%module netcdf
%{
/* Includes the header in the wrapper code */
#include "netcdf.h"
%}
/* Parse the header file to generate wrappers */
%include "netcdf.h"
我做了:
gcc `php-config --includes` -fpic -c netcdf_wrap.c
gcc -shared netcdf_wrap.o -o netcdf.so
但是当在php中加载扩展时,我得到:
Unable to load dynamic library netcdf.so:
undefined symbol: ncerr in Unknown on line 0
这是我第一次尝试这样的东西。我错过了什么吗?
ADDED -lnetcdf flag。
现在,我得到了:未定义的符号:zend_error_noreturn。修复netcdf_wrap.c中的zend_error替换zend_error_noreturn
答案 0 :(得分:1)
您的直接问题是由于没有链接到libnetcdf引起的。您需要gcc的-l
标志才能这样做:
gcc -shared netcdf_wrap.o -o netcdf.so -lnetcdf
☝
答案 1 :(得分:0)
P.S。我是作者。